1 /*
2  * Copyright (c) 2023 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 #include "style_modifier.h"
16 
17 #include <cstddef>
18 #include <cstdint>
19 #include <map>
20 #include <unordered_map>
21 #include <regex>
22 #include <string>
23 #include "securec.h"
24 #include "drawable_descriptor.h"
25 #include <cstdlib>
26 
27 #include "frame_information.h"
28 #include "native_node.h"
29 #include "native_type.h"
30 #include "node_extened.h"
31 #include "node_model.h"
32 #include "node_transition.h"
33 #include "styled_string.h"
34 #include "waterflow_section_option.h"
35 
36 #include "base/error/error_code.h"
37 #include "base/log/log_wrapper.h"
38 #include "base/utils/string_utils.h"
39 #include "base/utils/utils.h"
40 #include "bridge/common/utils/utils.h"
41 #include "core/components/common/properties/color.h"
42 #include "core/components_ng/base/frame_node.h"
43 #include "core/interfaces/arkoala/arkoala_api.h"
44 #include "core/interfaces/native/node/node_api.h"
45 
46 namespace OHOS::Ace::NodeModel {
47 namespace {
48 const std::regex COLOR_WITH_MAGIC("#[0-9A-Fa-f]{8}");
49 const std::regex BRACKETS("\\(.*?\\)");
50 const std::regex FLOAT_MAGIC("^[0-9]+(\\.[0-9]+)?$");
51 const std::regex SIZE_TYPE_MAGIC("([0-9]+)([a-z]+)");
52 constexpr char PARAMS_SEPARATOR_LEVEL1 = ';';
53 constexpr int UNIT_PX = 0;
54 constexpr int UNIT_VP = 1;
55 constexpr int UNIT_FP = 2;
56 constexpr int UNIT_PERCENT = 3;
57 constexpr int NUM_0 = 0;
58 constexpr int NUM_1 = 1;
59 constexpr int NUM_2 = 2;
60 constexpr int NUM_3 = 3;
61 constexpr int NUM_4 = 4;
62 constexpr int NUM_5 = 5;
63 constexpr int NUM_6 = 6;
64 constexpr int NUM_7 = 7;
65 constexpr int NUM_8 = 8;
66 constexpr int NUM_9 = 9;
67 constexpr int NUM_10 = 10;
68 constexpr int NUM_11 = 11;
69 constexpr int NUM_12 = 12;
70 constexpr int NUM_13 = 13;
71 constexpr int NUM_15 = 15;
72 constexpr int NUM_16 = 16;
73 constexpr int NUM_23 = 23;
74 constexpr int NUM_29 = 29;
75 constexpr int NUM_31 = 31;
76 constexpr int NUM_59 = 59;
77 constexpr int NUM_100 = 100;
78 constexpr int NUM_400 = 400;
79 const int ALLOW_SIZE_1(1);
80 const int ALLOW_SIZE_2(2);
81 const int ALLOW_SIZE_3(3);
82 const int ALLOW_SIZE_4(4);
83 const int ALLOW_SIZE_5(5);
84 const int ALLOW_SIZE_7(7);
85 const int ALLOW_SIZE_8(8);
86 const int ALLOW_SIZE_16(16);
87 const int ALLOW_SIZE_10(10);
88 
89 constexpr int DEFAULT_SIZE_18 = 18;
90 constexpr int DEFAULT_SIZE_24 = 24;
91 constexpr int DEFAULT_SIZE_50 = 50;
92 constexpr int COLOR_STRATEGY_STYLE = 1;
93 constexpr int COLOR_STYLE = 2;
94 constexpr int DISPLAY_ARROW_FALSE = 0;
95 constexpr int DISPLAY_ARROW_TRUE = 1;
96 constexpr int32_t X_INDEX = 0;
97 constexpr int32_t Y_INDEX = 1;
98 constexpr int32_t Z_INDEX = 2;
99 constexpr int32_t CENTER_X_INDEX = 0;
100 constexpr int32_t CENTER_Y_INDEX = 1;
101 constexpr int32_t CENTER_Z_INDEX = 2;
102 constexpr int32_t CENTER_X_PERCENT_INDEX = 3;
103 constexpr int32_t CENTER_Y_PERCENT_INDEX = 4;
104 constexpr int32_t CENTER_Z_PERCENT_INDEX = 5;
105 constexpr int32_t ROTATE_PERSPECTIVE_INDEX = 4;
106 constexpr int32_t ROTATE_ANGLE_INDEX = 3;
107 constexpr uint32_t ARRAY_SIZE = 3;
108 constexpr int32_t BACKGROUND_IMAGE_WIDTH_INDEX = 0;
109 constexpr int32_t BACKGROUND_IMAGE_HEIGHT_INDEX = 1;
110 constexpr float DEFAULT_OPACITY = 1.0f;
111 
112 constexpr int32_t BLUR_STYLE_INDEX = 0;
113 constexpr int32_t COLOR_MODE_INDEX = 1;
114 constexpr int32_t ADAPTIVE_COLOR_INDEX = 2;
115 constexpr int32_t SCALE_INDEX = 3;
116 constexpr int32_t GRAY_SCALE_START = 4;
117 constexpr int32_t GRAY_SCALE_END = 5;
118 constexpr float MAX_GRAYSCALE = 127.0f;
119 constexpr int32_t DECORATION_COLOR_INDEX = 1;
120 constexpr int32_t DECORATION_STYLE_INDEX = 2;
121 constexpr int32_t PROGRESS_TYPE_LINEAR = 1;
122 constexpr int32_t PROGRESS_TYPE_RING = 2;
123 constexpr int32_t PROGRESS_TYPE_SCALE = 3;
124 constexpr int32_t PROGRESS_TYPE_MOON = 7;
125 constexpr int32_t PROGRESS_TYPE_CAPSULE = 9;
126 const std::vector<int32_t> PROGRESS_TYPE_ARRAY = { PROGRESS_TYPE_LINEAR, PROGRESS_TYPE_RING, PROGRESS_TYPE_MOON,
127     PROGRESS_TYPE_SCALE, PROGRESS_TYPE_CAPSULE};
128 constexpr int32_t OBJECT_FIT_FILL = 0;
129 constexpr int32_t OBJECT_FIT_CONTAIN = 1;
130 constexpr int32_t OBJECT_FIT_COVER = 2;
131 constexpr int32_t OBJECT_FIT_AUTO = 3;
132 constexpr int32_t OBJECT_FIT_NONE = 5;
133 constexpr int32_t OBJECT_FIT_SCALE_DOWN = 6;
134 constexpr int32_t OBJECT_FIT_NONE_ALIGN_TOP_START = 7;
135 constexpr int32_t OBJECT_FIT_NONE_ALIGN_TOP = 8;
136 constexpr int32_t OBJECT_FIT_NONE_ALIGN_TOP_END = 9;
137 constexpr int32_t OBJECT_FIT_NONE_ALIGN_START = 10;
138 constexpr int32_t OBJECT_FIT_NONE_ALIGN_CENTER = 11;
139 constexpr int32_t OBJECT_FIT_NONE_ALIGN_END = 12;
140 constexpr int32_t OBJECT_FIT_NONE_ALIGN_BOTTOM_START = 13;
141 constexpr int32_t OBJECT_FIT_NONE_ALIGN_BOTTOM = 14;
142 constexpr int32_t OBJECT_FIT_NONE_ALIGN_BOTTOM_END = 15;
143 const std::vector<int32_t> OBJECT_FIT_ARRAY = { OBJECT_FIT_CONTAIN, OBJECT_FIT_COVER, OBJECT_FIT_AUTO,
144     OBJECT_FIT_FILL, OBJECT_FIT_SCALE_DOWN, OBJECT_FIT_NONE,
145     OBJECT_FIT_NONE_ALIGN_TOP_START, OBJECT_FIT_NONE_ALIGN_TOP, OBJECT_FIT_NONE_ALIGN_TOP_END,
146     OBJECT_FIT_NONE_ALIGN_START, OBJECT_FIT_NONE_ALIGN_CENTER, OBJECT_FIT_NONE_ALIGN_END,
147     OBJECT_FIT_NONE_ALIGN_BOTTOM_START, OBJECT_FIT_NONE_ALIGN_BOTTOM, OBJECT_FIT_NONE_ALIGN_BOTTOM_END };
148 constexpr int32_t IMAGE_SPAN_ALIGNMENT_BASELINE = 4;
149 constexpr int32_t IMAGE_SPAN_ALIGNMENT_BOTTOM = 3;
150 constexpr int32_t IMAGE_SPAN_ALIGNMENT_CENTER = 2;
151 constexpr int32_t IMAGE_SPAN_ALIGNMENT_TOP = 1;
152 const std::vector<int32_t> IMAGE_SPAN_ALIGNMENT_ARRAY = { IMAGE_SPAN_ALIGNMENT_BASELINE, IMAGE_SPAN_ALIGNMENT_BOTTOM,
153     IMAGE_SPAN_ALIGNMENT_CENTER, IMAGE_SPAN_ALIGNMENT_TOP };
154 const std::vector<std::string> CURVE_ARRAY = { "linear", "ease", "ease-in", "ease-out", "ease-in-out",
155     "fast-out-slow-in", "linear-out-slow-in", "fast-out-linear-in", "extreme-deceleration", "sharp", "rhythm", "smooth",
156     "friction" };
157 const std::vector<std::string> FONT_STYLES = { "normal", "italic" };
158 const std::vector<std::string> LENGTH_METRIC_UNIT = { "px", "vp", "fp" };
159 std::unordered_map<int32_t, bool> SPAN_ATTRIBUTES_MAP = {
160     { static_cast<int32_t>(NODE_SPAN_CONTENT), true },
161     { static_cast<int32_t>(NODE_TEXT_DECORATION), true },
162     { static_cast<int32_t>(NODE_FONT_COLOR), true },
163     { static_cast<int32_t>(NODE_FONT_SIZE), true },
164     { static_cast<int32_t>(NODE_FONT_STYLE), true },
165     { static_cast<int32_t>(NODE_FONT_WEIGHT), true },
166     { static_cast<int32_t>(NODE_TEXT_LINE_HEIGHT), true },
167     { static_cast<int32_t>(NODE_TEXT_CASE), true },
168     { static_cast<int32_t>(NODE_TEXT_LETTER_SPACING), true },
169     { static_cast<int32_t>(NODE_FONT_FAMILY), true },
170     { static_cast<int32_t>(NODE_TEXT_TEXT_SHADOW), true },
171     { static_cast<int32_t>(NODE_SPAN_TEXT_BACKGROUND_STYLE), true },
172     { static_cast<int32_t>(NODE_SPAN_BASELINE_OFFSET), true },
173 };
174 constexpr int32_t ANIMATION_DURATION_INDEX = 0;
175 constexpr int32_t ANIMATION_CURVE_INDEX = 1;
176 constexpr int32_t ANIMATION_DELAY_INDEX = 2;
177 constexpr int32_t ANIMATION_INTERATION_INDEX = 3;
178 constexpr int32_t ANIMATION_PLAY_MODE_INDEX = 4;
179 constexpr int32_t ANIMATION_TEMPO_INDEX = 5;
180 constexpr int32_t ANIMATION_PLAY_MODE_REVERSE_VALUE = 2;
181 constexpr int32_t ANIMATION_PLAY_MODE_ALTERNATE_VALUE = 1;
182 constexpr int32_t OPACITY_ANIMATION_BASE = 1;
183 constexpr int32_t MOVE_ANIMATION_BASE = 1;
184 constexpr int32_t ROTATE_ANIMATION_BASE = 5;
185 constexpr int32_t SCALE_ANIMATION_BASE = 3;
186 constexpr int32_t TRANSLATE_ANIMATION_BASE = 3;
187 constexpr int32_t DEFAULT_DURATION = 1000;
188 const std::vector<std::string> ALIGN_RULES_HORIZONTAL_ARRAY = { "start", "center", "end" };
189 const std::vector<std::string> ALIGN_RULES_VERTICAL_ARRAY = { "top", "center", "bottom" };
190 constexpr int32_t TWO = 2;
191 constexpr float ZERO_F = 0.0f;
192 constexpr float HUNDRED = 100.0f;
193 constexpr float SLIDER_STEP_MIN_F = 0.01f;
194 constexpr float HALF = 0.5f;
195 constexpr float DEFAULT_HINT_RADIUS = 16.0f;
196 constexpr float DEFAULT_SCROLL_FADING_EDGE_LENGTH = 32.0f;
197 constexpr int32_t REQUIRED_ONE_PARAM = 1;
198 constexpr int32_t REQUIRED_TWO_PARAM = 2;
199 constexpr int32_t REQUIRED_THREE_PARAM = 3;
200 constexpr int32_t REQUIRED_FOUR_PARAM = 4;
201 constexpr int32_t REQUIRED_FIVE_PARAM = 5;
202 constexpr int32_t REQUIRED_SEVEN_PARAM = 7;
203 constexpr int32_t REQUIRED_TWENTY_PARAM = 20;
204 constexpr int32_t MAX_ATTRIBUTE_ITEM_LEN = 20;
205 std::string g_stringValue;
206 ArkUI_NumberValue g_numberValues[MAX_ATTRIBUTE_ITEM_LEN] = { 0 };
207 ArkUI_AttributeItem g_attributeItem = { g_numberValues, MAX_ATTRIBUTE_ITEM_LEN, nullptr, nullptr };
208 
209 constexpr uint32_t DEFAULT_COLOR = 0xFF000000; // Black
210 constexpr uint32_t DEFAULT_FIll_COLOR = 0x00000000;
211 constexpr int32_t DEFAULT_X = 0;
212 constexpr int32_t DEFAULT_Y = 0;
213 
214 constexpr int32_t DEFAULT_TRUE = 1;
215 constexpr int32_t DEFAULT_FALSE = 0;
216 
217 constexpr int32_t RETURN_SIZE_ONE = 1;
218 constexpr int32_t EDGE_TYPE_INDEX = 0;
219 constexpr int32_t EDGE_OFFSET_X_INDEX = 1;
220 constexpr int32_t EDGE_OFFSET_Y_INDEX = 2;
221 constexpr int32_t SELECTED_YEAR_INDEX = 0;
222 constexpr int32_t SELECTED_MONTH_INDEX = 1;
223 constexpr int32_t SELECTED_DAY_INDEX = 2;
224 constexpr int32_t DATEPICKER_START_TIME = 1970;
225 constexpr int32_t DATEPICKER_END_TIME = 2100;
226 constexpr int32_t CALENDAR_PICKER_FONT_COLOR_INDEX = 0;
227 constexpr int32_t CALENDAR_PICKER_FONT_SIZE_INDEX = 1;
228 constexpr int32_t CALENDAR_PICKER_FONT_WEIGHT_INDEX = 2;
229 constexpr int32_t IMAGE_SIZE_TYPE_CONTAIN_INDEX = 0;
230 constexpr int32_t IMAGE_SIZE_TYPE_COVER_INDEX = 1;
231 constexpr int32_t IMAGE_SIZE_TYPE_AUTO_INDEX = 2;
232 constexpr int32_t ERROR_CODE = -1;
233 constexpr int32_t OUTLINE_LEFT_WIDTH_INDEX = 0;
234 constexpr int32_t OUTLINE_TOP_WIDTH_INDEX = 1;
235 constexpr int32_t OUTLINE_RIGHT_WIDTH_INDEX = 2;
236 constexpr int32_t OUTLINE_BOTTOM_WIDTH_INDEX = 3;
237 constexpr uint32_t CONVERT_CONTENT_TYPE = 5;
238 constexpr uint32_t DEFAULT_PICKER_STYLE_COLOR = 0xFF182431;
239 constexpr uint32_t DEFAULT_PICKER_SELECTED_COLOR = 0xFF007DFF;
240 const std::string EMPTY_STR = "";
241 const std::vector<std::string> ACCESSIBILITY_LEVEL_VECTOR = { "auto", "yes", "no", "no-hide-descendants" };
242 std::map<std::string, int32_t> ACCESSIBILITY_LEVEL_MAP = { { "auto", 0 }, { "yes", 1 }, { "no", 2 },
243     { "no-hide-descendants", 3 } };
244 
245 std::unordered_map<uint32_t, std::string> ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MAP = {
246     { static_cast<uint32_t>(ARKUI_NODE_CUSTOM), "Custom" },
247     { static_cast<uint32_t>(ARKUI_NODE_TEXT), "Text" },
248     { static_cast<uint32_t>(ARKUI_NODE_SPAN), "Span" },
249     { static_cast<uint32_t>(ARKUI_NODE_IMAGE_SPAN), "ImageSpan" },
250     { static_cast<uint32_t>(ARKUI_NODE_IMAGE), "Image" },
251     { static_cast<uint32_t>(ARKUI_NODE_TOGGLE), "Toggle" },
252     { static_cast<uint32_t>(ARKUI_NODE_LOADING_PROGRESS), "LoadingProgress" },
253     { static_cast<uint32_t>(ARKUI_NODE_TEXT_INPUT), "TextInput" },
254     { static_cast<uint32_t>(ARKUI_NODE_TEXT_AREA), "TextArea" },
255     { static_cast<uint32_t>(ARKUI_NODE_BUTTON), "Button" },
256     { static_cast<uint32_t>(ARKUI_NODE_PROGRESS), "Progress" },
257     { static_cast<uint32_t>(ARKUI_NODE_CHECKBOX), "Checkbox" },
258     { static_cast<uint32_t>(ARKUI_NODE_XCOMPONENT), "Xcomponent" },
259     { static_cast<uint32_t>(ARKUI_NODE_DATE_PICKER), "DatePicker" },
260     { static_cast<uint32_t>(ARKUI_NODE_TIME_PICKER), "TimePicker" },
261     { static_cast<uint32_t>(ARKUI_NODE_TEXT_PICKER), "TextPicker" },
262     { static_cast<uint32_t>(ARKUI_NODE_CALENDAR_PICKER), "CalendarPicker" },
263     { static_cast<uint32_t>(ARKUI_NODE_SLIDER), "Slider" },
264     { static_cast<uint32_t>(ARKUI_NODE_RADIO), "Radio" },
265     { static_cast<uint32_t>(ARKUI_NODE_STACK), "Stack" },
266     { static_cast<uint32_t>(ARKUI_NODE_SWIPER), "Swiper" },
267     { static_cast<uint32_t>(ARKUI_NODE_SCROLL), "Scroll" },
268     { static_cast<uint32_t>(ARKUI_NODE_LIST), "List" },
269     { static_cast<uint32_t>(ARKUI_NODE_LIST_ITEM), "ListItem" },
270     { static_cast<uint32_t>(ARKUI_NODE_LIST_ITEM_GROUP), "ListItemGroup" },
271     { static_cast<uint32_t>(ARKUI_NODE_COLUMN), "Column" },
272     { static_cast<uint32_t>(ARKUI_NODE_ROW), "Row" },
273     { static_cast<uint32_t>(ARKUI_NODE_FLEX), "Flex" },
274     { static_cast<uint32_t>(ARKUI_NODE_REFRESH), "Refresh" },
275     { static_cast<uint32_t>(ARKUI_NODE_WATER_FLOW), "WaterFlow" },
276     { static_cast<uint32_t>(ARKUI_NODE_FLOW_ITEM), "FlowItem" },
277     { static_cast<uint32_t>(ARKUI_NODE_RELATIVE_CONTAINER), "RelativeContainer" },
278     { static_cast<uint32_t>(ARKUI_NODE_GRID), "Grid" },
279     { static_cast<uint32_t>(ARKUI_NODE_GRID_ITEM), "GridItem" },
280     { static_cast<uint32_t>(ARKUI_NODE_CUSTOM_SPAN), "CustomSpan" },
281 };
282 
283 std::unordered_map<std::string, uint32_t> ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP = {
284     { "Custom", static_cast<uint32_t>(ARKUI_NODE_CUSTOM) },
285     { "Text", static_cast<uint32_t>(ARKUI_NODE_TEXT) },
286     { "Span", static_cast<uint32_t>(ARKUI_NODE_SPAN) },
287     { "ImageSpan", static_cast<uint32_t>(ARKUI_NODE_IMAGE_SPAN) },
288     { "Image", static_cast<uint32_t>(ARKUI_NODE_IMAGE) },
289     { "Toggle", static_cast<uint32_t>(ARKUI_NODE_TOGGLE) },
290     { "LoadingProgress", static_cast<uint32_t>(ARKUI_NODE_LOADING_PROGRESS) },
291     { "TextInput", static_cast<uint32_t>(ARKUI_NODE_TEXT_INPUT) },
292     { "TextArea", static_cast<uint32_t>(ARKUI_NODE_TEXT_AREA) },
293     { "Button", static_cast<uint32_t>(ARKUI_NODE_BUTTON) },
294     { "Progress", static_cast<uint32_t>(ARKUI_NODE_PROGRESS) },
295     { "Checkbox", static_cast<uint32_t>(ARKUI_NODE_CHECKBOX) },
296     { "Xcomponent", static_cast<uint32_t>(ARKUI_NODE_XCOMPONENT) },
297     { "DatePicker", static_cast<uint32_t>(ARKUI_NODE_DATE_PICKER) },
298     { "TimePicker", static_cast<uint32_t>(ARKUI_NODE_TIME_PICKER) },
299     { "TextPicker", static_cast<uint32_t>(ARKUI_NODE_TEXT_PICKER) },
300     { "CalendarPicker", static_cast<uint32_t>(ARKUI_NODE_CALENDAR_PICKER) },
301     { "Slider", static_cast<uint32_t>(ARKUI_NODE_SLIDER) },
302     { "Radio", static_cast<uint32_t>(ARKUI_NODE_RADIO) },
303     { "Stack", static_cast<uint32_t>(ARKUI_NODE_STACK) },
304     { "Swiper", static_cast<uint32_t>(ARKUI_NODE_SWIPER) },
305     { "Scroll", static_cast<uint32_t>(ARKUI_NODE_SCROLL) },
306     { "List", static_cast<uint32_t>(ARKUI_NODE_LIST) },
307     { "ListItem", static_cast<uint32_t>(ARKUI_NODE_LIST_ITEM) },
308     { "ListItemGroup", static_cast<uint32_t>(ARKUI_NODE_LIST_ITEM_GROUP) },
309     { "Column", static_cast<uint32_t>(ARKUI_NODE_COLUMN) },
310     { "Row", static_cast<uint32_t>(ARKUI_NODE_ROW) },
311     { "Flex", static_cast<uint32_t>(ARKUI_NODE_FLEX) },
312     { "Refresh", static_cast<uint32_t>(ARKUI_NODE_REFRESH) },
313     { "WaterFlow", static_cast<uint32_t>(ARKUI_NODE_WATER_FLOW) },
314     { "FlowItem", static_cast<uint32_t>(ARKUI_NODE_FLOW_ITEM) },
315     { "RelativeContainer", static_cast<uint32_t>(ARKUI_NODE_RELATIVE_CONTAINER) },
316     { "Grid", static_cast<uint32_t>(ARKUI_NODE_GRID) },
317     { "GridItem", static_cast<uint32_t>(ARKUI_NODE_GRID_ITEM) },
318     { "CustomSpan", static_cast<uint32_t>(ARKUI_NODE_CUSTOM_SPAN) },
319 };
320 
ResetAttributeItem()321 void ResetAttributeItem()
322 {
323     for (int i = 0; i < MAX_ATTRIBUTE_ITEM_LEN; ++i) {
324         g_numberValues[i].i32 = 0;
325     }
326     g_attributeItem.size = 0;
327     g_attributeItem.string = nullptr;
328     g_attributeItem.object = nullptr;
329 }
StringToColorInt(const char * string,uint32_t defaultValue=0)330 uint32_t StringToColorInt(const char* string, uint32_t defaultValue = 0)
331 {
332     std::smatch matches;
333     std::string colorStr(string);
334     if (std::regex_match(colorStr, matches, COLOR_WITH_MAGIC)) {
335         colorStr.erase(0, 1);
336         constexpr int colorNumFormat = 16;
337         errno = 0;
338         char* end = nullptr;
339         unsigned long int value = strtoul(colorStr.c_str(), &end, colorNumFormat);
340         if (errno == ERANGE) {
341             LOGE("%{public}s is out of range.", colorStr.c_str());
342         }
343         if (value == 0 && end == colorStr.c_str()) {
344             LOGW("input %{public}s can not covert to number, use default color:0x00000000" , colorStr.c_str());
345         }
346 
347         return value;
348     }
349     return defaultValue;
350 }
351 
GetDefaultUnit(ArkUI_NodeHandle nodePtr,int32_t defaultUnit)352 int32_t GetDefaultUnit(ArkUI_NodeHandle nodePtr, int32_t defaultUnit)
353 {
354     if (nodePtr->lengthMetricUnit == ARKUI_LENGTH_METRIC_UNIT_DEFAULT) {
355         return defaultUnit;
356     }
357     return static_cast<int32_t>(nodePtr->lengthMetricUnit);
358 }
359 
StringToInt(const char * string,int defaultValue=0)360 int StringToInt(const char* string, int defaultValue = 0)
361 {
362     char* end;
363     auto value = std::strtol(string, &end, 10);
364     if (end == string || errno == ERANGE || (value < INT_MIN || value > INT_MAX)) {
365         return defaultValue;
366     }
367     return value;
368 }
369 
StringToEnumInt(const char * value,const std::vector<std::string> & vec,int defaultValue)370 int StringToEnumInt(const char* value, const std::vector<std::string>& vec, int defaultValue)
371 {
372     std::string input(value);
373     auto it = std::find_if(vec.begin(), vec.end(), [&input](const std::string& str) { return str == input; });
374     if (it != vec.end()) {
375         return std::distance(vec.begin(), it);
376     }
377     return defaultValue;
378 }
379 
CurveToString(int curve)380 std::string CurveToString(int curve)
381 {
382     std::string curveStr = "linear";
383     switch (curve) {
384         case ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR:
385             curveStr = "linear";
386             break;
387         case ArkUI_AnimationCurve::ARKUI_CURVE_EASE:
388             curveStr = "ease";
389             break;
390         case ArkUI_AnimationCurve::ARKUI_CURVE_EASE_IN:
391             curveStr = "ease-in";
392             break;
393         case ArkUI_AnimationCurve::ARKUI_CURVE_EASE_OUT:
394             curveStr = "ease-out";
395             break;
396         case ArkUI_AnimationCurve::ARKUI_CURVE_EASE_IN_OUT:
397             curveStr = "ease-in-out";
398             break;
399         case ArkUI_AnimationCurve::ARKUI_CURVE_FAST_OUT_SLOW_IN:
400             curveStr = "fast-out-slow-in";
401             break;
402         case ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR_OUT_SLOW_IN:
403             curveStr = "linear-out-slow-in";
404             break;
405         case ArkUI_AnimationCurve::ARKUI_CURVE_FAST_OUT_LINEAR_IN:
406             curveStr = "fast-out-linear-in";
407             break;
408         case ArkUI_AnimationCurve::ARKUI_CURVE_EXTREME_DECELERATION:
409             curveStr = "extreme-deceleration";
410             break;
411         case ArkUI_AnimationCurve::ARKUI_CURVE_SHARP:
412             curveStr = "sharp";
413             break;
414         case ArkUI_AnimationCurve::ARKUI_CURVE_RHYTHM:
415             curveStr = "rhythm";
416             break;
417         case ArkUI_AnimationCurve::ARKUI_CURVE_SMOOTH:
418             curveStr = "smooth";
419             break;
420         case ArkUI_AnimationCurve::ARKUI_CURVE_FRICTION:
421             curveStr = "friction";
422             break;
423         default:
424             break;
425     }
426     return curveStr;
427 }
428 
ShapeToString(int shape)429 std::string ShapeToString(int shape)
430 {
431     std::string shapeStr = "rect";
432     switch (shape) {
433         case NUM_0:
434             shapeStr = "rect";
435             break;
436         case NUM_1:
437             shapeStr = "circle";
438             break;
439         case NUM_2:
440             shapeStr = "ellipse";
441             break;
442         case NUM_3:
443             shapeStr = "path";
444             break;
445         case NUM_4:
446             shapeStr = "progress";
447             break;
448         default:
449             break;
450     }
451     return shapeStr;
452 }
453 
ConvertBlurStyle(int32_t originBlurStyle)454 int32_t ConvertBlurStyle(int32_t originBlurStyle)
455 {
456     if (originBlurStyle < static_cast<int32_t>(ARKUI_BLUR_STYLE_NONE)) {
457         return originBlurStyle + 1;
458     } else if (originBlurStyle == static_cast<int32_t>(ARKUI_BLUR_STYLE_NONE)) {
459         return 0;
460     }
461     return originBlurStyle;
462 }
463 
UnConvertBlurStyle(int32_t blurStyle)464 int32_t UnConvertBlurStyle(int32_t blurStyle)
465 {
466     if (blurStyle == 0) {
467         return static_cast<int32_t>(ARKUI_BLUR_STYLE_NONE);
468     } else if (blurStyle <= static_cast<int32_t>(ARKUI_BLUR_STYLE_NONE)) {
469         return blurStyle - 1;
470     }
471     return blurStyle;
472 }
473 
ConvertAnimationDirection(int32_t animationPlayMode)474 int32_t ConvertAnimationDirection(int32_t animationPlayMode)
475 {
476     if (animationPlayMode == static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_REVERSE)) {
477         return ANIMATION_PLAY_MODE_REVERSE_VALUE;
478     } else if (animationPlayMode == static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_ALTERNATE)) {
479         return ANIMATION_PLAY_MODE_ALTERNATE_VALUE;
480     }
481     return animationPlayMode;
482 }
483 
UnConvertAnimationDirection(int32_t animationPlayMode)484 int32_t UnConvertAnimationDirection(int32_t animationPlayMode)
485 {
486     if (animationPlayMode == static_cast<int32_t>(ANIMATION_PLAY_MODE_REVERSE_VALUE)) {
487         return static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_REVERSE);
488     } else if (animationPlayMode == static_cast<int32_t>(ANIMATION_PLAY_MODE_ALTERNATE_VALUE)) {
489         return static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_ALTERNATE);
490     }
491     return animationPlayMode;
492 }
493 
ConvertAccessibilityRole(uint32_t nodeTypeInt)494 std::string ConvertAccessibilityRole(uint32_t nodeTypeInt)
495 {
496     std::string nodeTypeString = EMPTY_STR;
497     auto it = ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MAP.find(nodeTypeInt);
498     if (it != ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MAP.end()) {
499         return ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MAP[nodeTypeInt];
500     }
501     return nodeTypeString;
502 }
503 
UnConvertAccessibilityRole(const std::string & nodeTypeString)504 int32_t UnConvertAccessibilityRole(const std::string& nodeTypeString)
505 {
506     int32_t nodeTypeInt = ERROR_CODE;
507     auto it = ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP.find(nodeTypeString);
508     if (it != ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP.end()) {
509         return static_cast<int32_t>(ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP[nodeTypeString]);
510     }
511     return nodeTypeInt;
512 }
513 
IsLeapYear(uint32_t year)514 bool IsLeapYear(uint32_t year)
515 {
516     return (year % NUM_4 == 0 && year % NUM_100 != 0) || (year % NUM_400 == 0);
517 }
518 
IsValidDate(uint32_t year,uint32_t month,uint32_t day)519 bool IsValidDate(uint32_t year, uint32_t month, uint32_t day)
520 {
521     if (year <= 0) {
522         return false;
523     }
524     if (month < NUM_1 || month > NUM_12) {
525         return false;
526     }
527     uint32_t daysInMonth[] = { 31, IsLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
528     if (day < 1 || day > daysInMonth[month - 1]) {
529         return false;
530     }
531     return true;
532 }
533 
CheckAttributeItemArray(const ArkUI_AttributeItem * item,int32_t requiredAtLeastSize)534 int32_t CheckAttributeItemArray(const ArkUI_AttributeItem* item, int32_t requiredAtLeastSize)
535 {
536     CHECK_NULL_RETURN(item, -1);
537     if (item->size < requiredAtLeastSize) {
538         return -1;
539     }
540     return item->size;
541 }
542 
CheckAttributeIsBool(int32_t value)543 bool CheckAttributeIsBool(int32_t value)
544 {
545     if (value == DEFAULT_FALSE || value == DEFAULT_TRUE) {
546         return true;
547     }
548     return false;
549 }
550 
CheckAttributeIsAlignment(int32_t value)551 bool CheckAttributeIsAlignment(int32_t value)
552 {
553     int32_t minEnumValue = static_cast<int32_t>(ArkUI_Alignment::ARKUI_ALIGNMENT_TOP_START);
554     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_Alignment::ARKUI_ALIGNMENT_BOTTOM_END);
555     return value >= minEnumValue && value <= maxEnumValue;
556 }
557 
CheckAttributeIsFontWeight(int32_t value)558 bool CheckAttributeIsFontWeight(int32_t value)
559 {
560     int32_t minEnumValue = static_cast<int32_t>(ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W100);
561     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_FontWeight::ARKUI_FONT_WEIGHT_REGULAR);
562     return value >= minEnumValue && value <= maxEnumValue;
563 }
564 
CheckAttributeIsFontStyle(int32_t value)565 bool CheckAttributeIsFontStyle(int32_t value)
566 {
567     int32_t minEnumValue = static_cast<int32_t>(ArkUI_FontStyle::ARKUI_FONT_STYLE_NORMAL);
568     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_FontStyle::ARKUI_FONT_STYLE_ITALIC);
569     return value >= minEnumValue && value <= maxEnumValue;
570 }
571 
CheckAttributeIsTextHeightAdaptivePolicy(int32_t value)572 bool CheckAttributeIsTextHeightAdaptivePolicy(int32_t value)
573 {
574     int32_t minEnumValue =
575         static_cast<int32_t>(ArkUI_TextHeightAdaptivePolicy::ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST);
576     int32_t maxEnumValue =
577         static_cast<int32_t>(ArkUI_TextHeightAdaptivePolicy::ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_LAYOUT_CONSTRAINT_FIRST);
578     return value >= minEnumValue && value <= maxEnumValue;
579 }
580 
CheckAttributeIsCopyOptions(int32_t value)581 bool CheckAttributeIsCopyOptions(int32_t value)
582 {
583     int32_t minEnumValue = static_cast<int32_t>(ArkUI_CopyOptions::ARKUI_COPY_OPTIONS_NONE);
584     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_CopyOptions::ARKUI_COPY_OPTIONS_CROSS_DEVICE);
585     return value >= minEnumValue && value <= maxEnumValue;
586 }
587 
CheckAttributeIsAnimationCurve(int32_t value)588 bool CheckAttributeIsAnimationCurve(int32_t value)
589 {
590     int32_t minEnumValue = static_cast<int32_t>(ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR);
591     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_AnimationCurve::ARKUI_CURVE_FRICTION);
592     return value >= minEnumValue && value <= maxEnumValue;
593 }
594 
CheckAttributeIsScrollNestedMode(int32_t value)595 bool CheckAttributeIsScrollNestedMode(int32_t value)
596 {
597     int32_t minEnumValue = static_cast<int32_t>(ArkUI_ScrollNestedMode::ARKUI_SCROLL_NESTED_MODE_SELF_ONLY);
598     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_ScrollNestedMode::ARKUI_SCROLL_NESTED_MODE_PARALLEL);
599     return value >= minEnumValue && value <= maxEnumValue;
600 }
601 
CheckAttributeIsSliderStyle(int32_t value)602 bool CheckAttributeIsSliderStyle(int32_t value)
603 {
604     int32_t minEnumValue = static_cast<int32_t>(ArkUI_SliderStyle::ARKUI_SLIDER_STYLE_OUT_SET);
605     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_SliderStyle::ARKUI_SLIDER_STYLE_NONE);
606     return value >= minEnumValue && value <= maxEnumValue;
607 }
608 
CheckAttributeIsSliderBlockStyle(int32_t value)609 bool CheckAttributeIsSliderBlockStyle(int32_t value)
610 {
611     int32_t minEnumValue = static_cast<int32_t>(ArkUI_SliderBlockStyle::ARKUI_SLIDER_BLOCK_STYLE_DEFAULT);
612     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_SliderBlockStyle::ARKUI_SLIDER_BLOCK_STYLE_SHAPE);
613     return value >= minEnumValue && value <= maxEnumValue;
614 }
615 
CheckAttributeIsSliderDirection(int32_t value)616 bool CheckAttributeIsSliderDirection(int32_t value)
617 {
618     int32_t minEnumValue = static_cast<int32_t>(ArkUI_SliderDirection::ARKUI_SLIDER_DIRECTION_VERTICAL);
619     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_SliderDirection::ARKUI_SLIDER_DIRECTION_HORIZONTAL);
620     return value >= minEnumValue && value <= maxEnumValue;
621 }
622 
CheckAttributeIsCheckboxShape(int32_t value)623 bool CheckAttributeIsCheckboxShape(int32_t value)
624 {
625     int32_t minEnumValue = static_cast<int32_t>(ArkUI_CheckboxShape::ArkUI_CHECKBOX_SHAPE_CIRCLE);
626     int32_t maxEnumValue = static_cast<int32_t>(ArkUI_CheckboxShape::ArkUI_CHECKBOX_SHAPE_ROUNDED_SQUARE);
627     return value >= minEnumValue && value <= maxEnumValue;
628 }
629 
CheckAttributeIsListItemAlign(int32_t value)630 bool CheckAttributeIsListItemAlign(int32_t value)
631 {
632     int32_t minEnumValue = static_cast<int32_t>(ArkUI_ListItemAlignment::ARKUI_LIST_ITEM_ALIGNMENT_START);
633     int32_t maxEnumValue =
634         static_cast<int32_t>(ArkUI_ListItemAlignment::ARKUI_LIST_ITEM_ALIGNMENT_END);
635     return value >= minEnumValue && value <= maxEnumValue;
636 }
637 
CheckAttributeIsAccessibilityLevel(int32_t value)638 bool CheckAttributeIsAccessibilityLevel(int32_t value)
639 {
640     int32_t minEnumValue = static_cast<int32_t>(ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_AUTO);
641     int32_t maxEnumValue =
642         static_cast<int32_t>(ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS);
643     return value >= minEnumValue && value <= maxEnumValue;
644 }
645 
CheckAttributeIsChainStyle(int32_t value)646 bool CheckAttributeIsChainStyle(int32_t value)
647 {
648     int32_t minEnumValue =
649         static_cast<int32_t>(ArkUI_RelativeLayoutChainStyle::ARKUI_RELATIVE_LAYOUT_CHAIN_STYLE_SPREAD);
650     int32_t maxEnumValue =
651         static_cast<int32_t>(ArkUI_RelativeLayoutChainStyle::ARKUI_RELATIVE_LAYOUT_CHAIN_STYLE_PACKED);
652     return value >= minEnumValue && value <= maxEnumValue;
653 }
654 
CheckAttributeIsAxis(int32_t value)655 bool CheckAttributeIsAxis(int32_t value)
656 {
657     int32_t minEnumValue = static_cast<int32_t>(ArkUI_Axis::ARKUI_AXIS_VERTICAL);
658     int32_t maxEnumValue =
659         static_cast<int32_t>(ArkUI_Axis::ARKUI_AXIS_HORIZONTAL);
660     return value >= minEnumValue && value <= maxEnumValue;
661 }
662 
CheckAttributeString(const ArkUI_AttributeItem * item)663 bool CheckAttributeString(const ArkUI_AttributeItem* item)
664 {
665     CHECK_NULL_RETURN(item, false);
666     if (!item->string) {
667         return false;
668     }
669     return true;
670 }
671 
CheckAttributeObject(const ArkUI_AttributeItem * item)672 bool CheckAttributeObject(const ArkUI_AttributeItem* item)
673 {
674     CHECK_NULL_RETURN(item, false);
675     if (!item->object) {
676         return false;
677     }
678     return true;
679 }
680 
CheckAttributeObjectAndSize(const ArkUI_AttributeItem * item)681 bool CheckAttributeObjectAndSize(const ArkUI_AttributeItem* item)
682 {
683     CHECK_NULL_RETURN(item, false);
684     if (!item->object || item->size == 0) {
685         return false;
686     }
687     return true;
688 }
689 
ParseImages(const ArkUI_AttributeItem * item,ArkUIImageFrameInfo * imageInfos,ArkUI_NodeHandle node)690 bool ParseImages(const ArkUI_AttributeItem* item, ArkUIImageFrameInfo* imageInfos, ArkUI_NodeHandle node)
691 {
692     auto images = reinterpret_cast<ArkUI_ImageAnimatorFrameInfo**>(item->object);
693     if (!images) {
694         return false;
695     }
696     for (int32_t i = 0; i < item->size; i++) {
697         CHECK_NULL_RETURN(images[i], false);
698         if (images[i]->drawableDescriptor) {
699             if (images[i]->drawableDescriptor->drawableDescriptor) {
700                 imageInfos[i].drawable = images[i]->drawableDescriptor->drawableDescriptor.get();
701             } else if (images[i]->drawableDescriptor->resource) {
702                 imageInfos[i].src = images[i]->drawableDescriptor->resource->src.c_str();
703             }
704         } else {
705             imageInfos[i].src = images[i]->src.c_str();
706         }
707         imageInfos[i].width = images[i]->width.value_or(0);
708         imageInfos[i].height = images[i]->height.value_or(0);
709         imageInfos[i].top = images[i]->top.value_or(0);
710         imageInfos[i].left = images[i]->left.value_or(0);
711         imageInfos[i].unit = GetDefaultUnit(node, UNIT_PX);
712         imageInfos[i].duration = images[i]->duration.value_or(0);
713     }
714     node->imageFrameInfos = images;
715     return true;
716 }
717 
CheckAttributeIndicator(const ArkUI_AttributeItem * item)718 bool CheckAttributeIndicator(const ArkUI_AttributeItem* item)
719 {
720     CHECK_NULL_RETURN(item, false);
721     if (item->value[0].i32 != ARKUI_SWIPER_INDICATOR_TYPE_DOT &&
722         item->value[0].i32 != ARKUI_SWIPER_INDICATOR_TYPE_DIGIT) {
723         return false;
724     }
725     if (!item->object) {
726         return false;
727     }
728     return true;
729 }
730 
CheckAnimation(const ArkUI_AttributeItem * item,int32_t size,int32_t animationIndexBase)731 bool CheckAnimation(const ArkUI_AttributeItem* item, int32_t size, int32_t animationIndexBase)
732 {
733     CHECK_NULL_RETURN(item, false);
734     const int32_t animationCurveIndex = animationIndexBase + ANIMATION_CURVE_INDEX;
735     if (animationCurveIndex < size &&
736         (item->value[animationCurveIndex].i32 < 0 ||
737             item->value[animationCurveIndex].i32 > static_cast<int32_t>(ARKUI_CURVE_FRICTION))) {
738         return false;
739     }
740     const int32_t playModeIndex = animationIndexBase + ANIMATION_PLAY_MODE_INDEX;
741     if (playModeIndex < size &&
742         (item->value[playModeIndex].i32 < 0 ||
743             item->value[playModeIndex].i32 > static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_ALTERNATE_REVERSE))) {
744         return false;
745     }
746     const int32_t animationTempoIndex = animationIndexBase + ANIMATION_TEMPO_INDEX;
747     if (animationTempoIndex < size && LessNotEqual(item->value[animationTempoIndex].f32, 0.0f)) {
748         return false;
749     }
750     return true;
751 }
752 
ParseAnimation(const ArkUI_AttributeItem * item,int32_t actualSize,ArkUIAnimationOptionType & animationOption,const int animationIndexBase)753 void ParseAnimation(const ArkUI_AttributeItem* item, int32_t actualSize, ArkUIAnimationOptionType& animationOption,
754     const int animationIndexBase)
755 {
756     const int32_t animationDurationIndex = animationIndexBase + ANIMATION_DURATION_INDEX;
757     int32_t duration = DEFAULT_DURATION;
758     if (animationDurationIndex < actualSize) {
759         duration = item->value[animationDurationIndex].i32;
760     }
761     const int32_t animationCurveIndex = animationIndexBase + ANIMATION_CURVE_INDEX;
762     int32_t curve = 0;
763     if (animationCurveIndex < actualSize &&
764         item->value[animationCurveIndex].i32 < static_cast<int32_t>(CURVE_ARRAY.size())) {
765         curve = item->value[animationCurveIndex].i32;
766     }
767     const int32_t animationDelayIndex = animationIndexBase + ANIMATION_DELAY_INDEX;
768     int32_t delay = 0;
769     if (animationDelayIndex < actualSize) {
770         delay = item->value[animationDelayIndex].i32;
771     }
772     const int32_t animationIterationsIndex = animationIndexBase + ANIMATION_INTERATION_INDEX;
773     int32_t iterations = 1;
774     if (animationIterationsIndex < actualSize) {
775         iterations = item->value[animationIterationsIndex].i32;
776     }
777     const int32_t animationPlayModeIndex = animationIndexBase + ANIMATION_PLAY_MODE_INDEX;
778     int32_t direction = 0;
779     if (animationPlayModeIndex < actualSize) {
780         direction = ConvertAnimationDirection(item->value[animationPlayModeIndex].i32);
781     }
782     const int32_t animationTempoIndex = animationIndexBase + ANIMATION_TEMPO_INDEX;
783     float tempo = 1.0f;
784     if (animationTempoIndex < actualSize) {
785         tempo = item->value[animationTempoIndex].f32;
786     }
787     animationOption.duration = duration;
788     animationOption.curve = curve;
789     animationOption.delay = delay;
790     animationOption.iteration = iterations;
791     animationOption.playMode = direction;
792     animationOption.tempo = tempo;
793 }
794 
ResetAnimation(ArkUIAnimationOptionType & animationOption)795 void ResetAnimation(ArkUIAnimationOptionType& animationOption)
796 {
797     animationOption.duration = DEFAULT_DURATION;
798     animationOption.curve = 0;
799     animationOption.delay = 0;
800     animationOption.iteration = 1;
801     animationOption.playMode = 0;
802     animationOption.tempo = 1.0f;
803 }
804 
805 // Common Attributes functions
SetWidth(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)806 int32_t SetWidth(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
807 {
808     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
809     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
810         return ERROR_CODE_PARAM_INVALID;
811     }
812     // already check in entry point.
813     auto* fullImpl = GetFullImpl();
814     // 1 for vp. check in DimensionUnit.
815     fullImpl->getNodeModifiers()->getCommonModifier()->setWidth(
816         node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr);
817     return ERROR_CODE_NO_ERROR;
818 }
819 
ResetWidth(ArkUI_NodeHandle node)820 void ResetWidth(ArkUI_NodeHandle node)
821 {
822     auto* fullImpl = GetFullImpl();
823     fullImpl->getNodeModifiers()->getCommonModifier()->resetWidth(node->uiNodeHandle);
824 }
825 
GetWidth(ArkUI_NodeHandle node)826 const ArkUI_AttributeItem* GetWidth(ArkUI_NodeHandle node)
827 {
828     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
829     g_numberValues[0].f32 = modifier->getWidth(node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
830     if (LessNotEqual(g_numberValues[0].f32, 0.0f)) {
831         return nullptr;
832     }
833     return &g_attributeItem;
834 }
835 
SetHeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)836 int32_t SetHeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
837 {
838     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
839     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
840         return ERROR_CODE_PARAM_INVALID;
841     }
842     // already check in entry point.
843     auto* fullImpl = GetFullImpl();
844     // 1 for vp. check in DimensionUnit.
845     fullImpl->getNodeModifiers()->getCommonModifier()->setHeight(
846         node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr);
847     return ERROR_CODE_NO_ERROR;
848 }
849 
ResetHeight(ArkUI_NodeHandle node)850 void ResetHeight(ArkUI_NodeHandle node)
851 {
852     auto* fullImpl = GetFullImpl();
853     fullImpl->getNodeModifiers()->getCommonModifier()->resetHeight(node->uiNodeHandle);
854 }
855 
GetHeight(ArkUI_NodeHandle node)856 const ArkUI_AttributeItem* GetHeight(ArkUI_NodeHandle node)
857 {
858     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
859     g_numberValues[0].f32 = modifier->getHeight(node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
860     if (LessNotEqual(g_numberValues[0].f32, 0.0f)) {
861         return nullptr;
862     }
863     return &g_attributeItem;
864 }
865 
SetBackgroundColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)866 int32_t SetBackgroundColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
867 {
868     if (item->size == 0) {
869         return ERROR_CODE_PARAM_INVALID;
870     }
871     // already check in entry point.
872     auto* fullImpl = GetFullImpl();
873     if (node->type == ARKUI_NODE_BUTTON) {
874         fullImpl->getNodeModifiers()->getButtonModifier()->setButtonBackgroundColor(
875             node->uiNodeHandle, item->value[NUM_0].u32);
876     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
877         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputBackgroundColor(
878             node->uiNodeHandle, item->value[NUM_0].u32);
879     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
880         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBackgroundColor(
881             node->uiNodeHandle, item->value[NUM_0].u32);
882     } else {
883         fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundColor(
884             node->uiNodeHandle, item->value[NUM_0].u32);
885     }
886     return ERROR_CODE_NO_ERROR;
887 }
888 
ResetBackgroundColor(ArkUI_NodeHandle node)889 void ResetBackgroundColor(ArkUI_NodeHandle node)
890 {
891     auto* fullImpl = GetFullImpl();
892     if (node->type == ARKUI_NODE_BUTTON) {
893         fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonBackgroundColor(node->uiNodeHandle);
894     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
895         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputBackgroundColor(node->uiNodeHandle);
896     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
897         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBackgroundColor(node->uiNodeHandle);
898     } else {
899         fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundColor(node->uiNodeHandle);
900     }
901 }
902 
GetBackgroundColor(ArkUI_NodeHandle node)903 const ArkUI_AttributeItem* GetBackgroundColor(ArkUI_NodeHandle node)
904 {
905     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
906     g_numberValues[0].u32 = modifier->getBackgroundColor(node->uiNodeHandle);
907     return &g_attributeItem;
908 }
909 
SetBackgroundImage(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)910 int32_t SetBackgroundImage(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
911 {
912     if ((!item->string && !item->object) || (item->string && item->object)) {
913         return ERROR_CODE_PARAM_INVALID;
914     }
915     if (item->size == NUM_1 &&
916         (item->value[NUM_0].i32 < 0 || item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_IMAGE_REPEAT_XY))) {
917         return ERROR_CODE_PARAM_INVALID;
918     }
919     // already check in entry point.
920     auto* fullImpl = GetFullImpl();
921     std::string bundle;
922     std::string module;
923     int repeat = item->size == NUM_1 ? item->value[NUM_0].i32 : ARKUI_IMAGE_REPEAT_NONE;
924     if (item->string) {
925         fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImage(
926             node->uiNodeHandle, item->string, bundle.c_str(), module.c_str(), repeat);
927     } else {
928         auto drawableDescriptor = reinterpret_cast<ArkUI_DrawableDescriptor*>(item->object);
929         if (!drawableDescriptor->drawableDescriptor) {
930             return ERROR_CODE_PARAM_INVALID;
931         }
932         fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImagePixelMap(
933             node->uiNodeHandle, drawableDescriptor->drawableDescriptor.get(), repeat);
934     }
935     return ERROR_CODE_NO_ERROR;
936 }
937 
ResetBackgroundImage(ArkUI_NodeHandle node)938 void ResetBackgroundImage(ArkUI_NodeHandle node)
939 {
940     auto* fullImpl = GetFullImpl();
941     fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundImage(node->uiNodeHandle);
942 }
943 
GetBackgroundImage(ArkUI_NodeHandle node)944 const ArkUI_AttributeItem* GetBackgroundImage(ArkUI_NodeHandle node)
945 {
946     auto* fullImpl = GetFullImpl();
947     ArkUIBackgroundImage options;
948     fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImage(node->uiNodeHandle, &options);
949     g_numberValues[NUM_0].i32 = options.repeat;
950     g_attributeItem.string = options.src;
951     return &g_attributeItem;
952 }
953 
SetPadding(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)954 int32_t SetPadding(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
955 {
956     if (item->size != NUM_1 && item->size != NUM_4) {
957         return ERROR_CODE_PARAM_INVALID;
958     }
959     // already check in entry point.
960     auto* fullImpl = GetFullImpl();
961     int topIndex = NUM_0;
962     int rightIndex = item->size == NUM_1 ? NUM_0 : NUM_1;
963     int bottomIndex = item->size == NUM_1 ? NUM_0 : NUM_2;
964     int leftIndex = item->size == NUM_1 ? NUM_0 : NUM_3;
965     int32_t unit = GetDefaultUnit(node, UNIT_VP);
966     struct ArkUISizeType top = { item->value[topIndex].f32, unit };
967     struct ArkUISizeType right = { item->value[rightIndex].f32, unit };
968     struct ArkUISizeType bottom = { item->value[bottomIndex].f32, unit };
969     struct ArkUISizeType left = { item->value[leftIndex].f32, unit };
970     if (node->type == ARKUI_NODE_TEXT_INPUT) {
971         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPadding(
972             node->uiNodeHandle, &top, &right, &bottom, &left);
973     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
974         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPadding(
975             node->uiNodeHandle, &top, &right, &bottom, &left);
976     } else {
977         fullImpl->getNodeModifiers()->getCommonModifier()->setPadding(
978             node->uiNodeHandle, &top, &right, &bottom, &left);
979     }
980     return ERROR_CODE_NO_ERROR;
981 }
982 
ResetPadding(ArkUI_NodeHandle node)983 void ResetPadding(ArkUI_NodeHandle node)
984 {
985     auto* fullImpl = GetFullImpl();
986     if (node->type == ARKUI_NODE_TEXT_INPUT) {
987         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputPadding(node->uiNodeHandle);
988     } else {
989         fullImpl->getNodeModifiers()->getCommonModifier()->resetPadding(node->uiNodeHandle);
990     }
991 }
992 
GetPadding(ArkUI_NodeHandle node)993 const ArkUI_AttributeItem* GetPadding(ArkUI_NodeHandle node)
994 {
995     auto* fullImpl = GetFullImpl();
996     ArkUI_Float32 paddings[NUM_4];
997     ArkUI_Int32 length = 0;
998     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
999     if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1000         fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaPadding(
1001             node->uiNodeHandle, &paddings, length, unit);
1002     } else {
1003         fullImpl->getNodeModifiers()->getCommonModifier()->getPadding(node->uiNodeHandle, &paddings, length, unit);
1004     }
1005     g_numberValues[NUM_0].f32 = paddings[NUM_0];
1006     g_numberValues[NUM_1].f32 = paddings[NUM_1];
1007     g_numberValues[NUM_2].f32 = paddings[NUM_2];
1008     g_numberValues[NUM_3].f32 = paddings[NUM_3];
1009     return &g_attributeItem;
1010 }
1011 
SetKey(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1012 int32_t SetKey(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1013 {
1014     if (!item->string) {
1015         return ERROR_CODE_PARAM_INVALID;
1016     }
1017     // already check in entry point.
1018     auto* fullImpl = GetFullImpl();
1019     fullImpl->getNodeModifiers()->getCommonModifier()->setKey(node->uiNodeHandle, item->string);
1020     return ERROR_CODE_NO_ERROR;
1021 }
1022 
ResetKey(ArkUI_NodeHandle node)1023 void ResetKey(ArkUI_NodeHandle node)
1024 {
1025     auto* fullImpl = GetFullImpl();
1026     fullImpl->getNodeModifiers()->getCommonModifier()->resetKey(node->uiNodeHandle);
1027 }
1028 
GetKey(ArkUI_NodeHandle node)1029 const ArkUI_AttributeItem* GetKey(ArkUI_NodeHandle node)
1030 {
1031     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1032     g_attributeItem.string = modifier->getKey(node->uiNodeHandle);
1033     return &g_attributeItem;
1034 }
1035 
SetEnabled(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1036 int32_t SetEnabled(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1037 {
1038     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1039     if (actualSize < 0 || item->value[NUM_0].i32 < 0) {
1040         return ERROR_CODE_PARAM_INVALID;
1041     }
1042     // already check in entry point.
1043     auto* fullImpl = GetFullImpl();
1044     fullImpl->getNodeModifiers()->getCommonModifier()->setEnabled(node->uiNodeHandle, item->value[0].i32);
1045     return ERROR_CODE_NO_ERROR;
1046 }
1047 
ResetEnabled(ArkUI_NodeHandle node)1048 void ResetEnabled(ArkUI_NodeHandle node)
1049 {
1050     auto* fullImpl = GetFullImpl();
1051     fullImpl->getNodeModifiers()->getCommonModifier()->resetEnabled(node->uiNodeHandle);
1052 }
1053 
GetEnabled(ArkUI_NodeHandle node)1054 const ArkUI_AttributeItem* GetEnabled(ArkUI_NodeHandle node)
1055 {
1056     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1057     g_numberValues[0].i32 = modifier->getEnabled(node->uiNodeHandle);
1058     return &g_attributeItem;
1059 }
1060 
SetMargin(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1061 int32_t SetMargin(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1062 {
1063     if (!item || (item->size != NUM_4 && item->size != NUM_1)) {
1064         return ERROR_CODE_PARAM_INVALID;
1065     }
1066     auto* fullImpl = GetFullImpl();
1067     ArkUISizeType top, right, bottom, left;
1068     top.value = right.value = bottom.value = left.value = NUM_0;
1069     top.unit = right.unit = bottom.unit = left.unit = GetDefaultUnit(node, UNIT_VP);
1070     if (item->size == NUM_1) {
1071         top.value = right.value = bottom.value = left.value = item->value[NUM_0].f32;
1072     } else if (item->size == NUM_4) {
1073         top.value = item->value[NUM_0].f32;
1074         right.value = item->value[NUM_1].f32;
1075         bottom.value = item->value[NUM_2].f32;
1076         left.value = item->value[NUM_3].f32;
1077     }
1078     if (node->type == ARKUI_NODE_TEXT_INPUT) {
1079         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputMargin(
1080             node->uiNodeHandle, &top, &right, &bottom, &left);
1081     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
1082         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaMargin(
1083             node->uiNodeHandle, &top, &right, &bottom, &left);
1084     } else {
1085         fullImpl->getNodeModifiers()->getCommonModifier()->setMargin(node->uiNodeHandle, &top, &right, &bottom, &left);
1086     }
1087     return ERROR_CODE_NO_ERROR;
1088 }
1089 
ResetMargin(ArkUI_NodeHandle node)1090 void ResetMargin(ArkUI_NodeHandle node)
1091 {
1092     // already check in entry point.
1093     auto* fullImpl = GetFullImpl();
1094     if (node->type == ARKUI_NODE_TEXT_INPUT) {
1095         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputMargin(node->uiNodeHandle);
1096     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
1097         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaMargin(node->uiNodeHandle);
1098     } else {
1099         fullImpl->getNodeModifiers()->getCommonModifier()->resetMargin(node->uiNodeHandle);
1100     }
1101 }
1102 
GetMargin(ArkUI_NodeHandle node)1103 const ArkUI_AttributeItem* GetMargin(ArkUI_NodeHandle node)
1104 {
1105     auto* fullImpl = GetFullImpl();
1106     ArkUI_Float32 margins[NUM_4];
1107     ArkUI_Int32 length = 0;
1108     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
1109     if (node->type == ARKUI_NODE_TEXT_INPUT) {
1110         fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputMargin(
1111             node->uiNodeHandle, &margins, length, unit);
1112     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
1113         fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaMargin(
1114             node->uiNodeHandle, &margins, length, unit);
1115     } else {
1116         fullImpl->getNodeModifiers()->getCommonModifier()->getMargin(node->uiNodeHandle, &margins, length, unit);
1117     }
1118     g_numberValues[NUM_0].f32 = margins[NUM_0];
1119     g_numberValues[NUM_1].f32 = margins[NUM_1];
1120     g_numberValues[NUM_2].f32 = margins[NUM_2];
1121     g_numberValues[NUM_3].f32 = margins[NUM_3];
1122     return &g_attributeItem;
1123 }
1124 
SetTranslate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1125 int32_t SetTranslate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1126 {
1127     auto actualSize = CheckAttributeItemArray(item, REQUIRED_THREE_PARAM);
1128     if (actualSize < 0) {
1129         return ERROR_CODE_PARAM_INVALID;
1130     }
1131     auto fullImpl = GetFullImpl();
1132     ArkUI_Float32 values[item->size];
1133     ArkUI_Int32 units[item->size];
1134     int32_t unit = GetDefaultUnit(node, UNIT_VP);
1135     for (int i = 0; i < item->size; ++i) {
1136         values[i] = item->value[i].f32;
1137         units[i] = unit;
1138     }
1139 
1140     fullImpl->getNodeModifiers()->getCommonModifier()->setTranslate(node->uiNodeHandle, values, units, item->size);
1141     return ERROR_CODE_NO_ERROR;
1142 }
1143 
ResetTranslate(ArkUI_NodeHandle node)1144 void ResetTranslate(ArkUI_NodeHandle node)
1145 {
1146     // already check in entry point.
1147     auto* fullImpl = GetFullImpl();
1148 
1149     fullImpl->getNodeModifiers()->getCommonModifier()->resetTranslate(node->uiNodeHandle);
1150 }
1151 
GetTranslate(ArkUI_NodeHandle node)1152 const ArkUI_AttributeItem* GetTranslate(ArkUI_NodeHandle node)
1153 {
1154     auto* fullImpl = GetFullImpl();
1155     ArkUI_Float32 translate[NUM_3];
1156     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
1157     fullImpl->getNodeModifiers()->getCommonModifier()->getTranslate(node->uiNodeHandle, &translate, unit);
1158     g_numberValues[NUM_0].f32 = translate[NUM_0];
1159     g_numberValues[NUM_1].f32 = translate[NUM_1];
1160     g_numberValues[NUM_2].f32 = translate[NUM_2];
1161     return &g_attributeItem;
1162 }
1163 
SetScale(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1164 int32_t SetScale(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1165 {
1166     auto fullImpl = GetFullImpl();
1167 
1168     if (item->size != NUM_5 && item->size != NUM_2) {
1169         return ERROR_CODE_PARAM_INVALID;
1170     }
1171     ArkUI_Float32 values[item->size];
1172     for (int i = 0; i < item->size; i++) {
1173         values[i] = item->value[i].f32;
1174     }
1175     int32_t unit = GetDefaultUnit(node, UNIT_VP);
1176     ArkUI_Int32 units[NUM_2] = { unit, unit };
1177     fullImpl->getNodeModifiers()->getCommonModifier()->setScale(node->uiNodeHandle, values, item->size, units, NUM_2);
1178     return ERROR_CODE_NO_ERROR;
1179 }
1180 
ResetScale(ArkUI_NodeHandle node)1181 void ResetScale(ArkUI_NodeHandle node)
1182 {
1183     // already check in entry point.
1184     auto* fullImpl = GetFullImpl();
1185 
1186     fullImpl->getNodeModifiers()->getCommonModifier()->resetScale(node->uiNodeHandle);
1187 }
1188 
GetScale(ArkUI_NodeHandle node)1189 const ArkUI_AttributeItem* GetScale(ArkUI_NodeHandle node)
1190 {
1191     auto* fullImpl = GetFullImpl();
1192     ArkUIScaleType scaleType = { 0.0f, 0.0f };
1193     fullImpl->getNodeModifiers()->getCommonModifier()->getScale(node->uiNodeHandle, &scaleType);
1194     g_numberValues[NUM_0].f32 = scaleType.xValue;
1195     g_numberValues[NUM_1].f32 = scaleType.yValue;
1196     g_attributeItem.size = NUM_2;
1197     return &g_attributeItem;
1198 }
1199 
SetRotate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1200 int32_t SetRotate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1201 {
1202     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FIVE_PARAM);
1203     if (actualSize < 0) {
1204         return ERROR_CODE_PARAM_INVALID;
1205     }
1206     auto fullImpl = GetFullImpl();
1207     ArkUI_Float32 values[item->size];
1208     for (int i = 0; i < item->size; ++i) {
1209         values[i] = item->value[i].f32;
1210     }
1211 
1212     fullImpl->getNodeModifiers()->getCommonModifier()->setRotateWithoutTransformCenter(
1213         node->uiNodeHandle, values, item->size);
1214     return ERROR_CODE_NO_ERROR;
1215 }
1216 
ResetRotate(ArkUI_NodeHandle node)1217 void ResetRotate(ArkUI_NodeHandle node)
1218 {
1219     // already check in entry point.
1220     auto* fullImpl = GetFullImpl();
1221 
1222     fullImpl->getNodeModifiers()->getCommonModifier()->resetRotate(node->uiNodeHandle);
1223 }
1224 
GetRotate(ArkUI_NodeHandle node)1225 const ArkUI_AttributeItem* GetRotate(ArkUI_NodeHandle node)
1226 {
1227     auto* fullImpl = GetFullImpl();
1228     ArkUIRotateType rotateType = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
1229     fullImpl->getNodeModifiers()->getCommonModifier()->getRotate(node->uiNodeHandle, &rotateType);
1230     g_numberValues[NUM_0].f32 = rotateType.xCoordinate;
1231     g_numberValues[NUM_1].f32 = rotateType.yCoordinate;
1232     g_numberValues[NUM_2].f32 = rotateType.zCoordinate;
1233     g_numberValues[NUM_3].f32 = rotateType.angle;
1234     g_numberValues[NUM_4].f32 = rotateType.sightDistance;
1235     g_attributeItem.size = NUM_5;
1236     return &g_attributeItem;
1237 }
1238 
SetBrightness(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1239 int32_t SetBrightness(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1240 {
1241     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1242     if (actualSize < 0) {
1243         return ERROR_CODE_PARAM_INVALID;
1244     }
1245     if (LessNotEqual(item->value[0].f32, 0.0f)) {
1246         return ERROR_CODE_PARAM_INVALID;
1247     }
1248     auto fullImpl = GetFullImpl();
1249     auto brightness = item->value[NUM_0].f32;
1250     fullImpl->getNodeModifiers()->getCommonModifier()->setBrightness(node->uiNodeHandle, brightness);
1251     return ERROR_CODE_NO_ERROR;
1252 }
1253 
ResetBrightness(ArkUI_NodeHandle node)1254 void ResetBrightness(ArkUI_NodeHandle node)
1255 {
1256     // already check in entry point.
1257     auto* fullImpl = GetFullImpl();
1258 
1259     fullImpl->getNodeModifiers()->getCommonModifier()->resetBrightness(node->uiNodeHandle);
1260 }
1261 
GetBrightness(ArkUI_NodeHandle node)1262 const ArkUI_AttributeItem* GetBrightness(ArkUI_NodeHandle node)
1263 {
1264     auto* fullImpl = GetFullImpl();
1265     g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getCommonModifier()->getBrightness(node->uiNodeHandle);
1266     g_attributeItem.size = NUM_1;
1267     return &g_attributeItem;
1268 }
1269 
SetSaturate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1270 int32_t SetSaturate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1271 {
1272     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1273     if (actualSize < 0 || !InRegion(NUM_0, DEFAULT_SIZE_50, item->value[NUM_0].f32)) {
1274         return ERROR_CODE_PARAM_INVALID;
1275     }
1276     auto fullImpl = GetFullImpl();
1277     auto saturate = item->value[NUM_0].f32;
1278     fullImpl->getNodeModifiers()->getCommonModifier()->setSaturate(node->uiNodeHandle, saturate);
1279     return ERROR_CODE_NO_ERROR;
1280 }
1281 
ResetSaturate(ArkUI_NodeHandle node)1282 void ResetSaturate(ArkUI_NodeHandle node)
1283 {
1284     // already check in entry point.
1285     auto* fullImpl = GetFullImpl();
1286 
1287     fullImpl->getNodeModifiers()->getCommonModifier()->resetSaturate(node->uiNodeHandle);
1288 }
1289 
GetSaturate(ArkUI_NodeHandle node)1290 const ArkUI_AttributeItem* GetSaturate(ArkUI_NodeHandle node)
1291 {
1292     auto* fullImpl = GetFullImpl();
1293     g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getCommonModifier()->getSaturate(node->uiNodeHandle);
1294     g_attributeItem.size = NUM_1;
1295     return &g_attributeItem;
1296 }
1297 
SetBlur(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1298 int32_t SetBlur(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1299 {
1300     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1301     if (actualSize < 0) {
1302         return ERROR_CODE_PARAM_INVALID;
1303     }
1304     auto fullImpl = GetFullImpl();
1305     ArkUI_Float64 blur = item->value[NUM_0].f32;
1306     BlurOption blurOption;
1307     fullImpl->getNodeModifiers()->getCommonModifier()->setBlur(
1308         node->uiNodeHandle, blur, blurOption.grayscale.data(), blurOption.grayscale.size());
1309     return ERROR_CODE_NO_ERROR;
1310 }
1311 
GetBlur(ArkUI_NodeHandle node)1312 const ArkUI_AttributeItem* GetBlur(ArkUI_NodeHandle node)
1313 {
1314     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getBlur(node->uiNodeHandle);
1315     g_numberValues[0].f32 = resultValue;
1316     return &g_attributeItem;
1317 }
1318 
ResetBlur(ArkUI_NodeHandle node)1319 void ResetBlur(ArkUI_NodeHandle node)
1320 {
1321     // already check in entry point.
1322     auto* fullImpl = GetFullImpl();
1323 
1324     fullImpl->getNodeModifiers()->getCommonModifier()->resetBlur(node->uiNodeHandle);
1325 }
1326 
SetLinearGradient(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1327 int32_t SetLinearGradient(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1328 {
1329     if (item->size < NUM_3) {
1330         return ERROR_CODE_PARAM_INVALID;
1331     }
1332     if (item->object == nullptr) {
1333         return ERROR_CODE_PARAM_INVALID;
1334     }
1335     //save direction value in node;
1336     node->linearGradientDirection = item->value[NUM_1].i32;
1337     auto* fullImpl = GetFullImpl();
1338     const ArkUI_ColorStop* colorStop = reinterpret_cast<ArkUI_ColorStop*>(item->object);
1339     int size = colorStop->size;
1340     ArkUIInt32orFloat32 colors[size * NUM_3];
1341     for (int i = 0; i < size; i++) {
1342         colors[i * NUM_3 + NUM_0].u32 = colorStop->colors[i];
1343         colors[i * NUM_3 + NUM_1].i32 = true;
1344         colors[i * NUM_3 + NUM_2].f32 = colorStop->stops[i] < 0 ? 0 : colorStop->stops[i];
1345     }
1346 
1347     auto isCustomDirection = item->value[NUM_1].i32 == static_cast<ArkUI_Int32>(ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM);
1348     ArkUIInt32orFloat32 values[NUM_4] = {
1349         {.i32 = static_cast<ArkUI_Int32>(isCustomDirection)}, //angleHasValue
1350         {.f32 = item->value[NUM_0].f32}, //angleValue
1351         {.i32 = item->value[NUM_1].i32}, //directionValue
1352         {.i32 = item->value[NUM_2].i32}  //repeating
1353     };
1354 
1355     fullImpl->getNodeModifiers()->getCommonModifier()->setLinearGradient(
1356         node->uiNodeHandle, values, NUM_4, colors, size * NUM_3);
1357     return ERROR_CODE_NO_ERROR;
1358 }
1359 
GetLinearGradient(ArkUI_NodeHandle node)1360 const ArkUI_AttributeItem* GetLinearGradient(ArkUI_NodeHandle node)
1361 {
1362     //default size 3
1363     ArkUI_Float32 values[NUM_3];
1364     //default size 10
1365     ArkUI_Uint32 colors[NUM_10];
1366     //default size 10
1367     ArkUI_Float32 stops[NUM_10];
1368     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getLinearGradient(
1369         node->uiNodeHandle, &values, &colors, &stops);
1370     //angle
1371     g_numberValues[0].f32 = values[0];
1372     //direction
1373     g_numberValues[1].i32 = node->linearGradientDirection > -1 ? node->linearGradientDirection : values[1];
1374     //repeated
1375     g_numberValues[2].i32 = values[2];
1376     //size
1377     g_attributeItem.size = NUM_3;
1378     if (resultValue < NUM_1) {
1379         return &g_attributeItem;
1380     }
1381 
1382     static ArkUI_ColorStop colorStop;
1383     static uint32_t gradientColors[NUM_10];
1384     static float gradientStops[NUM_10];
1385     for (int i = 0; i < resultValue; i++) {
1386         gradientColors[i] = colors[i];
1387         gradientStops[i] = stops[i] / 100.0f; //百分比转换为小数
1388     }
1389     colorStop.colors = gradientColors;
1390     colorStop.stops = gradientStops;
1391     colorStop.size = resultValue;
1392     g_attributeItem.object = &colorStop;
1393     return &g_attributeItem;
1394 }
1395 
ResetLinearGradient(ArkUI_NodeHandle node)1396 void ResetLinearGradient(ArkUI_NodeHandle node)
1397 {
1398     // already check in entry point.
1399     auto* fullImpl = GetFullImpl();
1400 
1401     fullImpl->getNodeModifiers()->getCommonModifier()->resetLinearGradient(node->uiNodeHandle);
1402 }
1403 
SetAlign(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1404 int32_t SetAlign(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1405 {
1406     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1407     if (actualSize < 0 || !InRegion(NUM_0, NUM_8, item->value[0].i32)) {
1408         return ERROR_CODE_PARAM_INVALID;
1409     }
1410     auto fullImpl = GetFullImpl();
1411     auto attrVal = item->value[NUM_0].i32;
1412     fullImpl->getNodeModifiers()->getCommonModifier()->setAlign(node->uiNodeHandle, attrVal);
1413     return ERROR_CODE_NO_ERROR;
1414 }
1415 
GetAlign(ArkUI_NodeHandle node)1416 const ArkUI_AttributeItem* GetAlign(ArkUI_NodeHandle node)
1417 {
1418     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAlign(node->uiNodeHandle);
1419     g_numberValues[0].i32 = resultValue;
1420     return &g_attributeItem;
1421 }
1422 
ResetAlign(ArkUI_NodeHandle node)1423 void ResetAlign(ArkUI_NodeHandle node)
1424 {
1425     // already check in entry point.
1426     auto* fullImpl = GetFullImpl();
1427 
1428     fullImpl->getNodeModifiers()->getCommonModifier()->resetAlign(node->uiNodeHandle);
1429 }
1430 
SetOpacity(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1431 int32_t SetOpacity(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1432 {
1433     if (item->size == 0) {
1434         return ERROR_CODE_PARAM_INVALID;
1435     }
1436     if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
1437         return ERROR_CODE_PARAM_INVALID;
1438     }
1439     // already check in entry point.
1440     auto* fullImpl = GetFullImpl();
1441     fullImpl->getNodeModifiers()->getCommonModifier()->setOpacity(node->uiNodeHandle, item->value[0].f32);
1442     return ERROR_CODE_NO_ERROR;
1443 }
1444 
ResetOpacity(ArkUI_NodeHandle node)1445 void ResetOpacity(ArkUI_NodeHandle node)
1446 {
1447     auto* fullImpl = GetFullImpl();
1448     fullImpl->getNodeModifiers()->getCommonModifier()->resetOpacity(node->uiNodeHandle);
1449 }
1450 
GetOpacity(ArkUI_NodeHandle node)1451 const ArkUI_AttributeItem* GetOpacity(ArkUI_NodeHandle node)
1452 {
1453     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1454     g_numberValues[0].f32 = modifier->getOpacity(node->uiNodeHandle);
1455     return &g_attributeItem;
1456 }
1457 
SetBorderWidth(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1458 int32_t SetBorderWidth(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1459 {
1460     if (item->size == 0) {
1461         return ERROR_CODE_PARAM_INVALID;
1462     }
1463     // already check in entry point.
1464     auto* fullImpl = GetFullImpl();
1465     int32_t unit = GetDefaultUnit(node, UNIT_VP);
1466     float widthVals[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
1467     int widthUnits[ALLOW_SIZE_4] = { unit, unit, unit, unit };
1468 
1469     if (item->size == 1) {
1470         if (LessNotEqual(item->value[0].f32, 0.0f)) {
1471             return ERROR_CODE_PARAM_INVALID;
1472         }
1473         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1474             widthVals[i] = item->value[0].f32;
1475         }
1476     } else if (item->size == ALLOW_SIZE_4) {
1477         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1478             if (LessNotEqual(item->value[i].f32, 0.0f)) {
1479                 return ERROR_CODE_PARAM_INVALID;
1480             } else {
1481                 widthVals[i] = item->value[i].f32;
1482             }
1483         }
1484     } else {
1485         return ERROR_CODE_PARAM_INVALID;
1486     }
1487     if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1488         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderWidth(
1489             node->uiNodeHandle, widthVals, widthUnits, ALLOW_SIZE_4);
1490     } else {
1491         fullImpl->getNodeModifiers()->getCommonModifier()->setBorderWidth(
1492             node->uiNodeHandle, widthVals, widthUnits, ALLOW_SIZE_4);
1493     }
1494     return ERROR_CODE_NO_ERROR;
1495 }
1496 
ResetBorderWidth(ArkUI_NodeHandle node)1497 void ResetBorderWidth(ArkUI_NodeHandle node)
1498 {
1499     auto* fullImpl = GetFullImpl();
1500     if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1501         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBorderWidth(node->uiNodeHandle);
1502     } else {
1503         fullImpl->getNodeModifiers()->getCommonModifier()->resetBorderWidth(node->uiNodeHandle);
1504     }
1505 }
1506 
GetBorderWidth(ArkUI_NodeHandle node)1507 const ArkUI_AttributeItem* GetBorderWidth(ArkUI_NodeHandle node)
1508 {
1509     auto* fullImpl = GetFullImpl();
1510     ArkUI_Float32 borderWidth[NUM_4];
1511     auto unit = GetDefaultUnit(node, UNIT_VP);
1512     fullImpl->getNodeModifiers()->getCommonModifier()->getBorderWidth(node->uiNodeHandle, &borderWidth, unit);
1513     g_numberValues[NUM_0].f32 = borderWidth[NUM_0];
1514     g_numberValues[NUM_1].f32 = borderWidth[NUM_1];
1515     g_numberValues[NUM_2].f32 = borderWidth[NUM_2];
1516     g_numberValues[NUM_3].f32 = borderWidth[NUM_3];
1517     return &g_attributeItem;
1518 }
1519 
SetBorderRadius(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1520 int32_t SetBorderRadius(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1521 {
1522     if (item->size == 0) {
1523         return ERROR_CODE_PARAM_INVALID;
1524     }
1525     // already check in entry point.
1526     auto* fullImpl = GetFullImpl();
1527     float radiusVals[ALLOW_SIZE_4] = { NUM_1, NUM_1, NUM_1, NUM_1 };
1528     int32_t unit = GetDefaultUnit(node, UNIT_VP);
1529     int radiusUnits[ALLOW_SIZE_4] = { unit, unit, unit, unit };
1530 
1531     if (item->size == 1) {
1532         if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
1533             return ERROR_CODE_PARAM_INVALID;
1534         }
1535         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1536             radiusVals[i] = item->value[NUM_0].f32;
1537         }
1538     } else if (item->size == ALLOW_SIZE_4) {
1539         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1540             if (LessNotEqual(item->value[i].f32, 0.0f)) {
1541                 return ERROR_CODE_PARAM_INVALID;
1542             } else {
1543                 radiusVals[i] = item->value[i].f32;
1544             }
1545         }
1546     } else {
1547         return ERROR_CODE_PARAM_INVALID;
1548     }
1549     if (node->type == ARKUI_NODE_IMAGE) {
1550         fullImpl->getNodeModifiers()->getImageModifier()->setImageBorderRadius(
1551             node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1552     } else if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1553         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderRadius(
1554             node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1555     } else if (node->type == ARKUI_NODE_IMAGE_SPAN) {
1556         fullImpl->getNodeModifiers()->getImageSpanModifier()->setImageSpanBorderRadius(
1557             node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1558     } else {
1559         fullImpl->getNodeModifiers()->getCommonModifier()->setBorderRadius(
1560             node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1561     }
1562     return ERROR_CODE_NO_ERROR;
1563 }
1564 
ResetBorderRadius(ArkUI_NodeHandle node)1565 void ResetBorderRadius(ArkUI_NodeHandle node)
1566 {
1567     auto* fullImpl = GetFullImpl();
1568     if (node->type == ARKUI_NODE_IMAGE) {
1569         fullImpl->getNodeModifiers()->getImageModifier()->resetImageBorderRadius(node->uiNodeHandle);
1570     } else if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1571         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBorderRadius(node->uiNodeHandle);
1572     } else if (node->type == ARKUI_NODE_IMAGE_SPAN) {
1573         fullImpl->getNodeModifiers()->getImageSpanModifier()->resetImageSpanBorderRadius(node->uiNodeHandle);
1574     } else {
1575         fullImpl->getNodeModifiers()->getCommonModifier()->resetBorderRadius(node->uiNodeHandle);
1576     }
1577 }
1578 
GetBorderRadius(ArkUI_NodeHandle node)1579 const ArkUI_AttributeItem* GetBorderRadius(ArkUI_NodeHandle node)
1580 {
1581     auto* fullImpl = GetFullImpl();
1582     ArkUI_Float32 borderRadius[NUM_4];
1583     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
1584     fullImpl->getNodeModifiers()->getCommonModifier()->getBorderRadius(node->uiNodeHandle, &borderRadius, unit);
1585     g_numberValues[NUM_0].f32 = borderRadius[NUM_0];
1586     g_numberValues[NUM_1].f32 = borderRadius[NUM_1];
1587     g_numberValues[NUM_2].f32 = borderRadius[NUM_2];
1588     g_numberValues[NUM_3].f32 = borderRadius[NUM_3];
1589     return &g_attributeItem;
1590 }
1591 
SetBorderWidthPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1592 int32_t SetBorderWidthPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1593 {
1594     if (item->size == 0) {
1595         return ERROR_CODE_PARAM_INVALID;
1596     }
1597     // already check in entry point.
1598     auto* fullImpl = GetFullImpl();
1599     float widthVals[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
1600     int widthUnits[ALLOW_SIZE_4] = { UNIT_PERCENT, UNIT_PERCENT, UNIT_PERCENT, UNIT_PERCENT };
1601 
1602     if (item->size == 1) {
1603         if (LessNotEqual(item->value[0].f32, 0.0f)) {
1604             return ERROR_CODE_PARAM_INVALID;
1605         }
1606         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1607             widthVals[i] = item->value[0].f32;
1608         }
1609     } else if (item->size == ALLOW_SIZE_4) {
1610         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1611             if (LessNotEqual(item->value[i].f32, 0.0f)) {
1612                 return ERROR_CODE_PARAM_INVALID;
1613             } else {
1614                 widthVals[i] = item->value[i].f32;
1615             }
1616         }
1617     } else {
1618         return ERROR_CODE_PARAM_INVALID;
1619     }
1620     if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1621         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderWidth(
1622             node->uiNodeHandle, widthVals, widthUnits, ALLOW_SIZE_4);
1623     } else {
1624         fullImpl->getNodeModifiers()->getCommonModifier()->setBorderWidth(
1625             node->uiNodeHandle, widthVals, widthUnits, ALLOW_SIZE_4);
1626     }
1627     return ERROR_CODE_NO_ERROR;
1628 }
1629 
ResetBorderWidthPercent(ArkUI_NodeHandle node)1630 void ResetBorderWidthPercent(ArkUI_NodeHandle node)
1631 {
1632     ResetBorderWidth(node);
1633 }
1634 
GetBorderWidthPercent(ArkUI_NodeHandle node)1635 const ArkUI_AttributeItem* GetBorderWidthPercent(ArkUI_NodeHandle node)
1636 {
1637     auto* fullImpl = GetFullImpl();
1638     ArkUI_Float32 borderWidth[NUM_4];
1639     fullImpl->getNodeModifiers()->getCommonModifier()->getBorderWidth(node->uiNodeHandle, &borderWidth, UNIT_PERCENT);
1640     g_numberValues[NUM_0].f32 = borderWidth[NUM_0];
1641     g_numberValues[NUM_1].f32 = borderWidth[NUM_1];
1642     g_numberValues[NUM_2].f32 = borderWidth[NUM_2];
1643     g_numberValues[NUM_3].f32 = borderWidth[NUM_3];
1644     return &g_attributeItem;
1645 }
1646 
SetBorderRadiusPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1647 int32_t SetBorderRadiusPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1648 {
1649     if (item->size == 0) {
1650         return ERROR_CODE_PARAM_INVALID;
1651     }
1652     // already check in entry point.
1653     auto* fullImpl = GetFullImpl();
1654     float radiusVals[ALLOW_SIZE_4] = { NUM_1, NUM_1, NUM_1, NUM_1 };
1655     int radiusUnits[ALLOW_SIZE_4] = { UNIT_PERCENT, UNIT_PERCENT, UNIT_PERCENT, UNIT_PERCENT };
1656 
1657     if (item->size == 1) {
1658         if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
1659             return ERROR_CODE_PARAM_INVALID;
1660         }
1661         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1662             radiusVals[i] = item->value[NUM_0].f32;
1663         }
1664     } else if (item->size == ALLOW_SIZE_4) {
1665         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1666             if (LessNotEqual(item->value[i].f32, 0.0f)) {
1667                 return ERROR_CODE_PARAM_INVALID;
1668             } else {
1669                 radiusVals[i] = item->value[i].f32;
1670             }
1671         }
1672     } else {
1673         return ERROR_CODE_PARAM_INVALID;
1674     }
1675     if (node->type == ARKUI_NODE_IMAGE) {
1676         fullImpl->getNodeModifiers()->getImageModifier()->setImageBorderRadius(
1677             node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1678     } else if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1679         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderRadius(
1680             node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1681     } else {
1682         fullImpl->getNodeModifiers()->getCommonModifier()->setBorderRadius(
1683             node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1684     }
1685     return ERROR_CODE_NO_ERROR;
1686 }
1687 
ResetBorderRadiusPercent(ArkUI_NodeHandle node)1688 void ResetBorderRadiusPercent(ArkUI_NodeHandle node)
1689 {
1690     ResetBorderRadius(node);
1691 }
1692 
GetBorderRadiusPercent(ArkUI_NodeHandle node)1693 const ArkUI_AttributeItem* GetBorderRadiusPercent(ArkUI_NodeHandle node)
1694 {
1695     auto* fullImpl = GetFullImpl();
1696     ArkUI_Float32 borderRadius[NUM_4];
1697     fullImpl->getNodeModifiers()->getCommonModifier()->getBorderRadius(node->uiNodeHandle, &borderRadius, UNIT_PERCENT);
1698     g_numberValues[NUM_0].f32 = borderRadius[NUM_0];
1699     g_numberValues[NUM_1].f32 = borderRadius[NUM_1];
1700     g_numberValues[NUM_2].f32 = borderRadius[NUM_2];
1701     g_numberValues[NUM_3].f32 = borderRadius[NUM_3];
1702     return &g_attributeItem;
1703 }
1704 
SetBorderColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1705 int32_t SetBorderColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1706 {
1707     if (item->size == 0) {
1708         return ERROR_CODE_PARAM_INVALID;
1709     }
1710     // already check in entry point.
1711     auto* fullImpl = GetFullImpl();
1712     uint32_t colors[ALLOW_SIZE_4] = { DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_COLOR };
1713     if (item->size == 1) {
1714         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1715             colors[i] = item->value[0].u32;
1716         }
1717     } else if (item->size == ALLOW_SIZE_4) {
1718         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1719             colors[i] = item->value[i].u32;
1720         }
1721     } else {
1722         return ERROR_CODE_PARAM_INVALID;
1723     }
1724     if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1725         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderColor(
1726             node->uiNodeHandle, colors[NUM_0], colors[NUM_1], colors[NUM_2], colors[NUM_3]);
1727     } else {
1728         fullImpl->getNodeModifiers()->getCommonModifier()->setBorderColor(
1729             node->uiNodeHandle, colors[NUM_0], colors[NUM_1], colors[NUM_2], colors[NUM_3]);
1730     }
1731     return ERROR_CODE_NO_ERROR;
1732 }
1733 
ResetBorderColor(ArkUI_NodeHandle node)1734 void ResetBorderColor(ArkUI_NodeHandle node)
1735 {
1736     auto* fullImpl = GetFullImpl();
1737     if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1738         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBorderColor(node->uiNodeHandle);
1739     } else {
1740         fullImpl->getNodeModifiers()->getCommonModifier()->resetBorderColor(node->uiNodeHandle);
1741     }
1742 }
1743 
GetBorderColor(ArkUI_NodeHandle node)1744 const ArkUI_AttributeItem* GetBorderColor(ArkUI_NodeHandle node)
1745 {
1746     auto* fullImpl = GetFullImpl();
1747     ArkUI_Uint32 colors[NUM_4];
1748     fullImpl->getNodeModifiers()->getCommonModifier()->getBorderColor(node->uiNodeHandle, &colors);
1749     g_numberValues[NUM_0].u32 = colors[NUM_0];
1750     g_numberValues[NUM_1].u32 = colors[NUM_1];
1751     g_numberValues[NUM_2].u32 = colors[NUM_2];
1752     g_numberValues[NUM_3].u32 = colors[NUM_3];
1753     return &g_attributeItem;
1754 }
1755 
SetBorderStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1756 int32_t SetBorderStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1757 {
1758     if (item->size == 0) {
1759         return ERROR_CODE_PARAM_INVALID;
1760     }
1761     // already check in entry point.
1762     auto* fullImpl = GetFullImpl();
1763     int styles[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
1764     if (item->size == 1) {
1765         if (item->value[0].i32 < ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID ||
1766             item->value[0].i32 > ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED) {
1767             return ERROR_CODE_PARAM_INVALID;
1768         }
1769         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1770             styles[i] = item->value[0].i32;
1771         }
1772     } else if (item->size == ALLOW_SIZE_4) {
1773         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1774             if (item->value[i].i32 < ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID ||
1775                 item->value[i].i32 > ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED) {
1776                 return ERROR_CODE_PARAM_INVALID;
1777             } else {
1778                 styles[i] = item->value[i].i32;
1779             }
1780         }
1781     } else {
1782         return ERROR_CODE_PARAM_INVALID;
1783     }
1784     if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1785         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderStyle(
1786             node->uiNodeHandle, styles, ALLOW_SIZE_4);
1787     } else {
1788         fullImpl->getNodeModifiers()->getCommonModifier()->setBorderStyle(node->uiNodeHandle, styles, ALLOW_SIZE_4);
1789     }
1790     return ERROR_CODE_NO_ERROR;
1791 }
1792 
ResetBorderStyle(ArkUI_NodeHandle node)1793 void ResetBorderStyle(ArkUI_NodeHandle node)
1794 {
1795     auto* fullImpl = GetFullImpl();
1796     if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1797         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBorderStyle(node->uiNodeHandle);
1798     } else {
1799         fullImpl->getNodeModifiers()->getCommonModifier()->resetBorderStyle(node->uiNodeHandle);
1800     }
1801 }
1802 
GetBorderStyle(ArkUI_NodeHandle node)1803 const ArkUI_AttributeItem* GetBorderStyle(ArkUI_NodeHandle node)
1804 {
1805     auto* fullImpl = GetFullImpl();
1806     ArkUI_Int32 styles[NUM_4];
1807     fullImpl->getNodeModifiers()->getCommonModifier()->getBorderStyle(node->uiNodeHandle, &styles);
1808     g_numberValues[NUM_0].i32 = styles[NUM_0];
1809     g_numberValues[NUM_1].i32 = styles[NUM_1];
1810     g_numberValues[NUM_2].i32 = styles[NUM_2];
1811     g_numberValues[NUM_3].i32 = styles[NUM_3];
1812     return &g_attributeItem;
1813 }
1814 
SetZIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1815 int32_t SetZIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1816 {
1817     if (item->size == 0) {
1818         return ERROR_CODE_PARAM_INVALID;
1819     }
1820     // already check in entry point.
1821     auto* fullImpl = GetFullImpl();
1822     fullImpl->getNodeModifiers()->getCommonModifier()->setZIndex(node->uiNodeHandle, item->value[0].i32);
1823     return ERROR_CODE_NO_ERROR;
1824 }
1825 
ResetZIndex(ArkUI_NodeHandle node)1826 void ResetZIndex(ArkUI_NodeHandle node)
1827 {
1828     auto* fullImpl = GetFullImpl();
1829     fullImpl->getNodeModifiers()->getCommonModifier()->resetZIndex(node->uiNodeHandle);
1830 }
1831 
GetZIndex(ArkUI_NodeHandle node)1832 const ArkUI_AttributeItem* GetZIndex(ArkUI_NodeHandle node)
1833 {
1834     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1835     g_numberValues[0].i32 = modifier->getZIndex(node->uiNodeHandle);
1836     return &g_attributeItem;
1837 }
1838 
SetVisibility(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1839 int32_t SetVisibility(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1840 {
1841     if (item->size == 0) {
1842         return ERROR_CODE_PARAM_INVALID;
1843     }
1844     if (item->value[0].i32 < ArkUI_Visibility::ARKUI_VISIBILITY_VISIBLE ||
1845         item->value[0].i32 > ArkUI_Visibility::ARKUI_VISIBILITY_NONE) {
1846         return ERROR_CODE_PARAM_INVALID;
1847     }
1848     // already check in entry point.
1849     auto* fullImpl = GetFullImpl();
1850     fullImpl->getNodeModifiers()->getCommonModifier()->setVisibility(node->uiNodeHandle, item->value[0].i32);
1851     return ERROR_CODE_NO_ERROR;
1852 }
1853 
ResetVisibility(ArkUI_NodeHandle node)1854 void ResetVisibility(ArkUI_NodeHandle node)
1855 {
1856     auto* fullImpl = GetFullImpl();
1857     fullImpl->getNodeModifiers()->getCommonModifier()->resetVisibility(node->uiNodeHandle);
1858 }
1859 
GetVisibility(ArkUI_NodeHandle node)1860 const ArkUI_AttributeItem* GetVisibility(ArkUI_NodeHandle node)
1861 {
1862     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1863     g_numberValues[0].i32 = modifier->getVisibility(node->uiNodeHandle);
1864     return &g_attributeItem;
1865 }
1866 
SetClip(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1867 int32_t SetClip(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1868 {
1869     if (item->size == 0) {
1870         return ERROR_CODE_PARAM_INVALID;
1871     }
1872     if (item->value[0].i32 < NUM_0 || item->value[0].i32 > NUM_1) {
1873         return ERROR_CODE_PARAM_INVALID;
1874     }
1875     auto* fullImpl = GetFullImpl();
1876     fullImpl->getNodeModifiers()->getCommonModifier()->setClip(node->uiNodeHandle, item->value[0].i32);
1877     return ERROR_CODE_NO_ERROR;
1878 }
1879 
ResetClip(ArkUI_NodeHandle node)1880 void ResetClip(ArkUI_NodeHandle node)
1881 {
1882     auto* fullImpl = GetFullImpl();
1883     fullImpl->getNodeModifiers()->getCommonModifier()->resetClip(node->uiNodeHandle);
1884 }
1885 
GetClip(ArkUI_NodeHandle node)1886 const ArkUI_AttributeItem* GetClip(ArkUI_NodeHandle node)
1887 {
1888     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1889     g_numberValues[0].i32 = modifier->getClip(node->uiNodeHandle);
1890     return &g_attributeItem;
1891 }
1892 
SetClipShape(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1893 int32_t SetClipShape(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1894 {
1895     if (item->size == 0) {
1896         return ERROR_CODE_PARAM_INVALID;
1897     }
1898     if (!InRegion(NUM_0, NUM_3, item->value[NUM_0].i32)) {
1899         return ERROR_CODE_PARAM_INVALID;
1900     }
1901     auto* fullImpl = GetFullImpl();
1902     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
1903     if (item->value[0].i32 == ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH) {
1904         if (item->string == nullptr) {
1905             return ERROR_CODE_PARAM_INVALID;
1906         }
1907         ArkUI_Float32 pathAttributes[NUM_2];
1908         if (LessNotEqual(item->value[NUM_1].f32, 0.0f) || LessNotEqual(item->value[NUM_2].f32, 0.0f)) {
1909             return ERROR_CODE_PARAM_INVALID;
1910         } else {
1911             pathAttributes[NUM_0] = item->value[NUM_1].f32;
1912             pathAttributes[NUM_1] = item->value[NUM_2].f32;
1913         }
1914         fullImpl->getNodeModifiers()->getCommonModifier()->setClipPath(
1915             node->uiNodeHandle, "path", &pathAttributes, item->string, unit);
1916     } else {
1917         ArkUI_Float32 attributes[item->size - NUM_1];
1918         for (int i = NUM_1; i < item->size; i++) {
1919             if (LessNotEqual(item->value[i].f32, 0.0f)) {
1920                 return ERROR_CODE_PARAM_INVALID;
1921             } else {
1922                 attributes[i - NUM_1] = item->value[i].f32;
1923             }
1924         }
1925         fullImpl->getNodeModifiers()->getCommonModifier()->setClipShape(
1926             node->uiNodeHandle, ShapeToString(item->value[0].i32).c_str(), attributes, item->size - NUM_1, unit);
1927     }
1928     return ERROR_CODE_NO_ERROR;
1929 }
1930 
ResetClipShape(ArkUI_NodeHandle node)1931 void ResetClipShape(ArkUI_NodeHandle node)
1932 {
1933     auto* fullImpl = GetFullImpl();
1934     fullImpl->getNodeModifiers()->getCommonModifier()->resetClip(node->uiNodeHandle);
1935 }
1936 
GetClipShape(ArkUI_NodeHandle node)1937 const ArkUI_AttributeItem* GetClipShape(ArkUI_NodeHandle node)
1938 {
1939     ArkUIClipShapeOptions options;
1940     auto unit = GetDefaultUnit(node, UNIT_VP);
1941     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getClipShape(node->uiNodeHandle, &options, unit);
1942     int type = options.type;
1943     if (type == static_cast<ArkUI_Int32>(BasicShapeType::RECT)) {
1944         g_numberValues[NUM_0].i32 = static_cast<ArkUI_Int32>(ArkUI_ClipType::ARKUI_CLIP_TYPE_RECTANGLE);
1945         g_numberValues[NUM_1].f32 = options.width;
1946         g_numberValues[NUM_2].f32 = options.height;
1947         g_numberValues[NUM_3].f32 = options.radiusWidth;
1948         g_numberValues[NUM_4].f32 = options.radiusHeight;
1949         g_numberValues[NUM_5].f32 = options.topLeftRadius;
1950         g_numberValues[NUM_6].f32 = options.bottomLeftRadius;
1951         g_numberValues[NUM_7].f32 = options.topRightRadius;
1952         g_numberValues[NUM_8].f32 = options.bottomRightRadius;
1953     } else if (type == static_cast<ArkUI_Int32>(BasicShapeType::CIRCLE)) {
1954         g_numberValues[NUM_0].i32 = static_cast<ArkUI_Int32>(ArkUI_ClipType::ARKUI_CLIP_TYPE_CIRCLE);
1955         g_numberValues[NUM_1].f32 = options.width;
1956         g_numberValues[NUM_2].f32 = options.height;
1957     } else if (type == static_cast<ArkUI_Int32>(BasicShapeType::ELLIPSE)) {
1958         g_numberValues[NUM_0].i32 = static_cast<ArkUI_Int32>(ArkUI_ClipType::ARKUI_CLIP_TYPE_ELLIPSE);
1959         g_numberValues[NUM_1].f32 = options.width;
1960         g_numberValues[NUM_2].f32 = options.height;
1961     } else if (type == static_cast<ArkUI_Int32>(BasicShapeType::PATH)) {
1962         g_numberValues[NUM_0].i32 = static_cast<ArkUI_Int32>(ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH);
1963         g_numberValues[NUM_1].f32 = options.width;
1964         g_numberValues[NUM_2].f32 = options.height;
1965         g_attributeItem.string = options.commands;
1966     } else {
1967         return nullptr;
1968     }
1969     return &g_attributeItem;
1970 }
1971 
SetTransform(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1972 int32_t SetTransform(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1973 {
1974     if (item->size == 0) {
1975         return ERROR_CODE_PARAM_INVALID;
1976     }
1977     // already check in entry point.
1978     auto* fullImpl = GetFullImpl();
1979     float transforms[ALLOW_SIZE_16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
1980     for (int i = 0; i < item->size; ++i) {
1981         transforms[i] = item->value[i].f32;
1982     }
1983     fullImpl->getNodeModifiers()->getCommonModifier()->setTransform(node->uiNodeHandle, transforms, ALLOW_SIZE_16);
1984     return ERROR_CODE_NO_ERROR;
1985 }
1986 
ResetTransform(ArkUI_NodeHandle node)1987 void ResetTransform(ArkUI_NodeHandle node)
1988 {
1989     auto* fullImpl = GetFullImpl();
1990     fullImpl->getNodeModifiers()->getCommonModifier()->resetTransform(node->uiNodeHandle);
1991 }
1992 
GetTransform(ArkUI_NodeHandle node)1993 const ArkUI_AttributeItem* GetTransform(ArkUI_NodeHandle node)
1994 {
1995     ArkUI_Float32 values[NUM_16];
1996     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getTransform(node->uiNodeHandle, &values);
1997     for (int i = 0; i < NUM_16; i++) {
1998         g_numberValues[i].f32 = values[i];
1999     }
2000     return &g_attributeItem;
2001 }
2002 
SetHitTestBehavior(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2003 int32_t SetHitTestBehavior(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2004 {
2005     if (item->size == 0) {
2006         return ERROR_CODE_PARAM_INVALID;
2007     }
2008     if (item->value[0].i32 < ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_DEFAULT ||
2009         item->value[0].i32 > ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_NONE) {
2010         return ERROR_CODE_PARAM_INVALID;
2011     }
2012     // already check in entry point.
2013     auto* fullImpl = GetFullImpl();
2014     fullImpl->getNodeModifiers()->getCommonModifier()->setHitTestBehavior(node->uiNodeHandle, item->value[0].i32);
2015     return ERROR_CODE_NO_ERROR;
2016 }
2017 
ResetHitTestBehavior(ArkUI_NodeHandle node)2018 void ResetHitTestBehavior(ArkUI_NodeHandle node)
2019 {
2020     auto* fullImpl = GetFullImpl();
2021     fullImpl->getNodeModifiers()->getCommonModifier()->resetHitTestBehavior(node->uiNodeHandle);
2022 }
2023 
GetHitTestBehavior(ArkUI_NodeHandle node)2024 const ArkUI_AttributeItem* GetHitTestBehavior(ArkUI_NodeHandle node)
2025 {
2026     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2027     g_numberValues[0].i32 = modifier->getHitTestBehavior(node->uiNodeHandle);
2028     return &g_attributeItem;
2029 }
2030 
SetPosition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2031 int32_t SetPosition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2032 {
2033     if (item->size == 0 && item->size != ALLOW_SIZE_2) {
2034         return ERROR_CODE_PARAM_INVALID;
2035     }
2036     // already check in entry point.
2037     auto* fullImpl = GetFullImpl();
2038     int32_t unit = GetDefaultUnit(node, UNIT_VP);
2039     fullImpl->getNodeModifiers()->getCommonModifier()->setPosition(
2040         node->uiNodeHandle, item->value[0].f32, unit, item->value[1].f32, unit);
2041     return ERROR_CODE_NO_ERROR;
2042 }
2043 
ResetPosition(ArkUI_NodeHandle node)2044 void ResetPosition(ArkUI_NodeHandle node)
2045 {
2046     auto* fullImpl = GetFullImpl();
2047     fullImpl->getNodeModifiers()->getCommonModifier()->resetPosition(node->uiNodeHandle);
2048 }
2049 
GetPosition(ArkUI_NodeHandle node)2050 const ArkUI_AttributeItem* GetPosition(ArkUI_NodeHandle node)
2051 {
2052     ArkUIPositionOptions options;
2053     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2054     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getPosition(node->uiNodeHandle, &options, unit);
2055     g_numberValues[NUM_0].f32 = options.x;
2056     g_numberValues[NUM_1].f32 = options.y;
2057     return &g_attributeItem;
2058 }
2059 
SetShadow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2060 int32_t SetShadow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2061 {
2062     if (item->size == 0) {
2063         return ERROR_CODE_PARAM_INVALID;
2064     }
2065     if (item->value[0].i32 < ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS ||
2066         item->value[0].i32 > ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD) {
2067         return ERROR_CODE_PARAM_INVALID;
2068     }
2069     auto* fullImpl = GetFullImpl();
2070     ArkUIInt32orFloat32 shadows[NUM_1] = { {.i32 = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS} };
2071     shadows[NUM_0].i32 = item->value[0].i32;
2072     fullImpl->getNodeModifiers()->getCommonModifier()->setBackShadow(node->uiNodeHandle, shadows, ALLOW_SIZE_1);
2073     return ERROR_CODE_NO_ERROR;
2074 }
2075 
ResetShadow(ArkUI_NodeHandle node)2076 void ResetShadow(ArkUI_NodeHandle node)
2077 {
2078     auto* fullImpl = GetFullImpl();
2079     fullImpl->getNodeModifiers()->getCommonModifier()->resetBackShadow(node->uiNodeHandle);
2080 }
2081 
GetShadow(ArkUI_NodeHandle node)2082 const ArkUI_AttributeItem* GetShadow(ArkUI_NodeHandle node)
2083 {
2084     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2085     g_numberValues[0].i32 = modifier->getShadow(node->uiNodeHandle);
2086     return &g_attributeItem;
2087 }
2088 
SetCustomShadow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2089 int32_t SetCustomShadow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2090 {
2091     if (item->size == 0) {
2092         return ERROR_CODE_PARAM_INVALID;
2093     }
2094     auto* fullImpl = GetFullImpl();
2095     ArkUIInt32orFloat32 shadows[ALLOW_SIZE_7] = { 0, { .i32 = NUM_2 }, 0, 0, { .i32 = 0 }, { .u32 = 0 }, { .i32 = 0 } };
2096     int length = item->size;
2097     if (length > NUM_0) {
2098         if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
2099             return ERROR_CODE_PARAM_INVALID;
2100         }
2101         shadows[NUM_0].f32 = item->value[NUM_0].f32; // radius
2102     }
2103     if (length > NUM_2) {
2104         shadows[NUM_2].f32 = item->value[NUM_2].f32; // OffsetX
2105     }
2106     if (length > NUM_3) {
2107         shadows[NUM_3].f32 = item->value[NUM_3].f32; // OffsetY
2108     }
2109     if (length > NUM_4) {
2110         if (!InRegion(NUM_0, NUM_1, item->value[NUM_4].i32)) {
2111             return ERROR_CODE_PARAM_INVALID;
2112         }
2113         shadows[NUM_4].i32 = item->value[NUM_4].i32;
2114     }
2115     if (length > NUM_5) {
2116         if (item->value[NUM_1].i32) {
2117             if (!InRegion(NUM_0, NUM_2, item->value[NUM_5].i32)) {
2118                 return ERROR_CODE_PARAM_INVALID;
2119             }
2120             shadows[NUM_1].i32 = COLOR_STRATEGY_STYLE;
2121             shadows[NUM_5].i32 = item->value[NUM_5].i32;
2122         } else {
2123             shadows[NUM_1].i32 = COLOR_STYLE;
2124             shadows[NUM_5].u32 = item->value[NUM_5].u32;
2125         }
2126     }
2127     if (length > NUM_6) {
2128         shadows[NUM_6].i32 = item->value[NUM_6].i32;
2129     }
2130     fullImpl->getNodeModifiers()->getCommonModifier()->setBackShadow(node->uiNodeHandle, shadows, ALLOW_SIZE_7);
2131     return ERROR_CODE_NO_ERROR;
2132 }
2133 
ResetCustomShadow(ArkUI_NodeHandle node)2134 void ResetCustomShadow(ArkUI_NodeHandle node)
2135 {
2136     auto* fullImpl = GetFullImpl();
2137     fullImpl->getNodeModifiers()->getCommonModifier()->resetBackShadow(node->uiNodeHandle);
2138 }
2139 
GetCustomShadow(ArkUI_NodeHandle node)2140 const ArkUI_AttributeItem* GetCustomShadow(ArkUI_NodeHandle node)
2141 {
2142     ArkUICustomShadowOptions options;
2143     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getCustomShadow(node->uiNodeHandle, &options);
2144     g_numberValues[NUM_0].f32 = options.radius;
2145     g_numberValues[NUM_1].i32 = options.colorStrategy;
2146     g_numberValues[NUM_2].f32 = options.offsetX;
2147     g_numberValues[NUM_3].f32 = options.offsetY;
2148     g_numberValues[NUM_4].i32 = options.shadowType;
2149     g_numberValues[NUM_5].u32 = options.color;
2150     g_numberValues[NUM_6].i32 = options.fill;
2151     return &g_attributeItem;
2152 }
2153 
SetFocusable(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2154 int32_t SetFocusable(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2155 {
2156     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
2157         return ERROR_CODE_PARAM_INVALID;
2158     }
2159     auto* fullImpl = GetFullImpl();
2160     fullImpl->getNodeModifiers()->getCommonModifier()->setFocusable(node->uiNodeHandle, item->value[0].i32);
2161     return ERROR_CODE_NO_ERROR;
2162 }
2163 
GetFocusable(ArkUI_NodeHandle node)2164 const ArkUI_AttributeItem* GetFocusable(ArkUI_NodeHandle node)
2165 {
2166     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getFocusable(node->uiNodeHandle);
2167     g_numberValues[0].i32 = resultValue;
2168     return &g_attributeItem;
2169 }
2170 
ResetFocusable(ArkUI_NodeHandle node)2171 void ResetFocusable(ArkUI_NodeHandle node)
2172 {
2173     auto* fullImpl = GetFullImpl();
2174     fullImpl->getNodeModifiers()->getCommonModifier()->resetFocusable(node->uiNodeHandle);
2175 }
2176 
SetAccessibilityGroup(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2177 int32_t SetAccessibilityGroup(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2178 {
2179     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
2180         return ERROR_CODE_PARAM_INVALID;
2181     }
2182     auto* fullImpl = GetFullImpl();
2183     fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityGroup(node->uiNodeHandle, item->value[0].i32);
2184     return ERROR_CODE_NO_ERROR;
2185 }
2186 
GetAccessibilityGroup(ArkUI_NodeHandle node)2187 const ArkUI_AttributeItem* GetAccessibilityGroup(ArkUI_NodeHandle node)
2188 {
2189     auto resultValue =
2190         GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAccessibilityGroup(node->uiNodeHandle);
2191     g_numberValues[0].i32 = resultValue;
2192     return &g_attributeItem;
2193 }
2194 
ResetAccessibilityGroup(ArkUI_NodeHandle node)2195 void ResetAccessibilityGroup(ArkUI_NodeHandle node)
2196 {
2197     auto* fullImpl = GetFullImpl();
2198     fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityGroup(node->uiNodeHandle);
2199 }
2200 
SetAccessibilityText(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2201 int32_t SetAccessibilityText(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2202 {
2203     if (item->string == nullptr) {
2204         return ERROR_CODE_PARAM_INVALID;
2205     }
2206     auto* fullImpl = GetFullImpl();
2207     fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityText(node->uiNodeHandle, item->string);
2208     return ERROR_CODE_NO_ERROR;
2209 }
2210 
GetAccessibilityText(ArkUI_NodeHandle node)2211 const ArkUI_AttributeItem* GetAccessibilityText(ArkUI_NodeHandle node)
2212 {
2213     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAccessibilityText(node->uiNodeHandle);
2214     g_attributeItem.string = resultValue;
2215     g_attributeItem.size = 0;
2216     return &g_attributeItem;
2217 }
2218 
ResetAccessibilityText(ArkUI_NodeHandle node)2219 void ResetAccessibilityText(ArkUI_NodeHandle node)
2220 {
2221     auto* fullImpl = GetFullImpl();
2222     fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityText(node->uiNodeHandle);
2223 }
2224 
SetAccessibilityLevel(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2225 int32_t SetAccessibilityLevel(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2226 {
2227     if (item->size == 0 || !CheckAttributeIsAccessibilityLevel(item->value[0].i32)) {
2228         return ERROR_CODE_PARAM_INVALID;
2229     }
2230     auto* fullImpl = GetFullImpl();
2231     auto levelString = ACCESSIBILITY_LEVEL_VECTOR[item->value[0].i32];
2232     fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityLevel(node->uiNodeHandle, levelString.c_str());
2233     return ERROR_CODE_NO_ERROR;
2234 }
2235 
GetAccessibilityLevel(ArkUI_NodeHandle node)2236 const ArkUI_AttributeItem* GetAccessibilityLevel(ArkUI_NodeHandle node)
2237 {
2238     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAccessibilityLevel(
2239         node->uiNodeHandle);
2240     std::string levelString(resultValue);
2241     g_numberValues[0].i32 = ACCESSIBILITY_LEVEL_MAP[levelString];
2242     return &g_attributeItem;
2243 }
2244 
ResetAccessibilityLevel(ArkUI_NodeHandle node)2245 void ResetAccessibilityLevel(ArkUI_NodeHandle node)
2246 {
2247     auto* fullImpl = GetFullImpl();
2248     fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityLevel(node->uiNodeHandle);
2249 }
2250 
SetAccessibilityDescription(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2251 int32_t SetAccessibilityDescription(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2252 {
2253     if (item->string == nullptr) {
2254         return ERROR_CODE_PARAM_INVALID;
2255     }
2256     auto* fullImpl = GetFullImpl();
2257     fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityDescription(node->uiNodeHandle, item->string);
2258     return ERROR_CODE_NO_ERROR;
2259 }
2260 
GetAccessibilityDescription(ArkUI_NodeHandle node)2261 const ArkUI_AttributeItem* GetAccessibilityDescription(ArkUI_NodeHandle node)
2262 {
2263     auto resultValue =
2264         GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAccessibilityDescription(node->uiNodeHandle);
2265     g_attributeItem.string = resultValue;
2266     g_attributeItem.size = 0;
2267     return &g_attributeItem;
2268 }
2269 
ResetAccessibilityDescription(ArkUI_NodeHandle node)2270 void ResetAccessibilityDescription(ArkUI_NodeHandle node)
2271 {
2272     auto* fullImpl = GetFullImpl();
2273     fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityDescription(node->uiNodeHandle);
2274 }
2275 
SetAccessibilityActions(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2276 int32_t SetAccessibilityActions(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2277 {
2278     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
2279     if (actualSize < 0) {
2280         return ERROR_CODE_PARAM_INVALID;
2281     }
2282     if (item->value[0].u32 > 0b11111) {
2283         return ERROR_CODE_PARAM_INVALID;
2284     }
2285     auto* fullImpl = GetFullImpl();
2286     fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityActions(
2287         node->uiNodeHandle, item->value[0].u32);
2288     return ERROR_CODE_NO_ERROR;
2289 }
2290 
ResetAccessibilityActions(ArkUI_NodeHandle node)2291 void ResetAccessibilityActions(ArkUI_NodeHandle node)
2292 {
2293     auto* fullImpl = GetFullImpl();
2294     fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityActions(node->uiNodeHandle);
2295 }
2296 
GetAccessibilityActions(ArkUI_NodeHandle node)2297 const ArkUI_AttributeItem* GetAccessibilityActions(ArkUI_NodeHandle node)
2298 {
2299     auto* fullImpl = GetFullImpl();
2300     g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityActions(
2301         node->uiNodeHandle);
2302     g_attributeItem.size = REQUIRED_ONE_PARAM;
2303     return &g_attributeItem;
2304 }
2305 
SetAccessibilityRole(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2306 int32_t SetAccessibilityRole(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2307 {
2308     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
2309     if (actualSize < 0) {
2310         return ERROR_CODE_PARAM_INVALID;
2311     }
2312     std::string nodeTypeString = ConvertAccessibilityRole(item->value[0].u32);
2313     if (nodeTypeString == EMPTY_STR) {
2314         return ERROR_CODE_PARAM_INVALID;
2315     }
2316     auto* fullImpl = GetFullImpl();
2317     fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityRole(
2318         node->uiNodeHandle, nodeTypeString.c_str());
2319     return ERROR_CODE_NO_ERROR;
2320 }
2321 
ResetAccessibilityRole(ArkUI_NodeHandle node)2322 void ResetAccessibilityRole(ArkUI_NodeHandle node)
2323 {
2324     auto* fullImpl = GetFullImpl();
2325     fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityRole(node->uiNodeHandle);
2326 }
2327 
GetAccessibilityRole(ArkUI_NodeHandle node)2328 const ArkUI_AttributeItem* GetAccessibilityRole(ArkUI_NodeHandle node)
2329 {
2330     auto* fullImpl = GetFullImpl();
2331     std::string nodeTypeString = fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityRole(
2332         node->uiNodeHandle);
2333     g_numberValues[0].u32 = static_cast<uint32_t>(UnConvertAccessibilityRole(nodeTypeString));
2334     g_attributeItem.size = REQUIRED_ONE_PARAM;
2335     return &g_attributeItem;
2336 }
2337 
SetDefaultFocus(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2338 int32_t SetDefaultFocus(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2339 {
2340     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
2341         return ERROR_CODE_PARAM_INVALID;
2342     }
2343     auto* fullImpl = GetFullImpl();
2344     fullImpl->getNodeModifiers()->getCommonModifier()->setDefaultFocus(node->uiNodeHandle, item->value[0].i32);
2345     return ERROR_CODE_NO_ERROR;
2346 }
2347 
GetDefaultFocus(ArkUI_NodeHandle node)2348 const ArkUI_AttributeItem* GetDefaultFocus(ArkUI_NodeHandle node)
2349 {
2350     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getDefaultFocus(node->uiNodeHandle);
2351     g_numberValues[0].i32 = resultValue;
2352     return &g_attributeItem;
2353 }
2354 
ResetDefaultFocus(ArkUI_NodeHandle node)2355 void ResetDefaultFocus(ArkUI_NodeHandle node)
2356 {
2357     auto* fullImpl = GetFullImpl();
2358     fullImpl->getNodeModifiers()->getCommonModifier()->resetDefaultFocus(node->uiNodeHandle);
2359 }
2360 
SetResponseRegion(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2361 int32_t SetResponseRegion(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2362 {
2363     if (item->size == 0 || item->size % NUM_4 > 0) {
2364         return ERROR_CODE_PARAM_INVALID;
2365     }
2366     auto* fullImpl = GetFullImpl();
2367 
2368     std::vector<float> valuesArray;
2369     std::vector<int> unitsArray;
2370 
2371     for (int i = 0; i < item->size; i++) {
2372         int remainder = i % NUM_4;
2373         valuesArray.push_back(remainder > 1 ? (item->value[i].f32) / HUNDRED : item->value[i].f32);
2374         // unit 1 3
2375         unitsArray.push_back(remainder > 1 ? NUM_3 : NUM_1);
2376     }
2377     fullImpl->getNodeModifiers()->getCommonModifier()->setResponseRegion(
2378         node->uiNodeHandle, valuesArray.data(), unitsArray.data(), valuesArray.size());
2379     return ERROR_CODE_NO_ERROR;
2380 }
2381 
GetResponseRegion(ArkUI_NodeHandle node)2382 const ArkUI_AttributeItem* GetResponseRegion(ArkUI_NodeHandle node)
2383 {
2384     ArkUI_Float32 values[32];
2385     auto valueSize =
2386         GetFullImpl()->getNodeModifiers()->getCommonModifier()->getResponseRegion(node->uiNodeHandle, &values);
2387     for (int i = 0; i < valueSize; i++) {
2388         g_numberValues[i].f32 = values[i];
2389     }
2390 
2391     g_attributeItem.size = valueSize;
2392     return &g_attributeItem;
2393 }
2394 
ResetResponseRegion(ArkUI_NodeHandle node)2395 void ResetResponseRegion(ArkUI_NodeHandle node)
2396 {
2397     auto* fullImpl = GetFullImpl();
2398     fullImpl->getNodeModifiers()->getCommonModifier()->resetResponseRegion(node->uiNodeHandle);
2399 }
2400 
SetOverlay(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2401 int32_t SetOverlay(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2402 {
2403     if (item->string == nullptr) {
2404         return ERROR_CODE_PARAM_INVALID;
2405     }
2406     auto* fullImpl = GetFullImpl();
2407 
2408     ArkUI_Float32 values[ALLOW_SIZE_10] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
2409 
2410     if (item->size > 0) {
2411         values[0] = 1;
2412         if (!CheckAttributeIsAlignment(item->value[0].i32)) {
2413             return ERROR_CODE_PARAM_INVALID;
2414         }
2415         values[1] = item->value[0].i32;
2416     }
2417 
2418     if (item->size > 1) {
2419         values[2] = 1;
2420         values[3] = item->value[1].f32;
2421         values[NUM_4] = GetDefaultUnit(node, UNIT_VP);
2422     }
2423 
2424     if (item->size > 2) {
2425         values[5] = 1;
2426         values[6] = item->value[2].f32;
2427         values[NUM_7] = GetDefaultUnit(node, UNIT_VP);
2428     }
2429     values[8] = item->size > 0 ? 1 : 0;
2430     values[9] = item->size > 1 ? 1 : 0;
2431     fullImpl->getNodeModifiers()->getCommonModifier()->setOverlay(
2432         node->uiNodeHandle, item->string, values, ALLOW_SIZE_10);
2433     return ERROR_CODE_NO_ERROR;
2434 }
2435 
GetOverlay(ArkUI_NodeHandle node)2436 const ArkUI_AttributeItem* GetOverlay(ArkUI_NodeHandle node)
2437 {
2438     ArkUIOverlayOptions options;
2439     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2440     auto contentStr = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getOverlay(
2441         node->uiNodeHandle, &options, unit);
2442     g_attributeItem.string = contentStr;
2443     int index = 0;
2444     //index 0 : align
2445     g_numberValues[index++].i32 = options.align;
2446     //index 1 : offset x
2447     g_numberValues[index++].f32 = options.x;
2448     //index 2 : offset y
2449     g_numberValues[index++].f32 = options.y;
2450     g_attributeItem.size = index;
2451     return &g_attributeItem;
2452 }
2453 
ResetOverlay(ArkUI_NodeHandle node)2454 void ResetOverlay(ArkUI_NodeHandle node)
2455 {
2456     auto* fullImpl = GetFullImpl();
2457     fullImpl->getNodeModifiers()->getCommonModifier()->resetOverlay(node->uiNodeHandle);
2458 }
2459 
SetBackgroundImagePosition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2460 int32_t SetBackgroundImagePosition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2461 {
2462     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
2463     if (actualSize < 0) {
2464         return ERROR_CODE_PARAM_INVALID;
2465     }
2466     auto fullImpl = GetFullImpl();
2467     ArkUI_Float32 values[] = { item->value[NUM_0].f32, item->value[NUM_1].f32 };
2468     int32_t unit = GetDefaultUnit(node, UNIT_PX);
2469     ArkUI_Int32 units[] = { unit, unit };
2470 
2471     fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImagePosition(
2472         node->uiNodeHandle, values, units, false, NUM_2);
2473     return ERROR_CODE_NO_ERROR;
2474 }
2475 
ResetBackgroundImagePosition(ArkUI_NodeHandle node)2476 void ResetBackgroundImagePosition(ArkUI_NodeHandle node)
2477 {
2478     auto* fullImpl = GetFullImpl();
2479 
2480     fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundImagePosition(node->uiNodeHandle);
2481 }
2482 
GetBackgroundImagePosition(ArkUI_NodeHandle node)2483 const ArkUI_AttributeItem* GetBackgroundImagePosition(ArkUI_NodeHandle node)
2484 {
2485     auto fullImpl = GetFullImpl();
2486     ArkUIPositionOptions positionOption = { 0.0f, 0.0f };
2487     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_PX);
2488     fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImagePosition(node->uiNodeHandle,
2489         &positionOption, unit);
2490     g_numberValues[NUM_0].f32 = positionOption.x;
2491     g_numberValues[NUM_1].f32 = positionOption.y;
2492     g_attributeItem.size = NUM_2;
2493     return &g_attributeItem;
2494 }
2495 
SetSweepGradient(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2496 int32_t SetSweepGradient(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2497 {
2498     if (item->size == 0) {
2499         return ERROR_CODE_PARAM_INVALID;
2500     }
2501     if (item->object == nullptr) {
2502         return ERROR_CODE_PARAM_INVALID;
2503     }
2504     auto* fullImpl = GetFullImpl();
2505     const ArkUI_ColorStop* colorStop = reinterpret_cast<ArkUI_ColorStop*>(item->object);
2506     int size = colorStop->size;
2507     ArkUIInt32orFloat32 colors[size * NUM_3];
2508     for (int i = 0; i < size; i++) {
2509         colors[i * NUM_3 + NUM_0].u32 = colorStop->colors[i];
2510         colors[i * NUM_3 + NUM_1].i32 = true;
2511         colors[i * NUM_3 + NUM_2].f32 = colorStop->stops[i];
2512     }
2513     int32_t unit = GetDefaultUnit(node, UNIT_VP);
2514     ArkUIInt32orFloat32 values[NUM_13] = {
2515         {.i32 = static_cast<ArkUI_Int32>(false)},
2516         {.f32 = static_cast<ArkUI_Float32>(DEFAULT_X)},
2517         {.i32 = static_cast<ArkUI_Int32>(unit)},
2518         {.i32 = static_cast<ArkUI_Int32>(false)},
2519         {.f32 = static_cast<ArkUI_Float32>(DEFAULT_Y)},
2520         {.i32 = static_cast<ArkUI_Int32>(unit)},
2521         {.i32 = static_cast<ArkUI_Int32>(false)},
2522         {.f32 = static_cast<ArkUI_Float32>(NUM_0)},
2523         {.i32 = static_cast<ArkUI_Int32>(false)},
2524         {.f32 = static_cast<ArkUI_Float32>(NUM_0)},
2525         {.i32 = static_cast<ArkUI_Int32>(false)},
2526         {.f32 = static_cast<ArkUI_Float32>(NUM_0)},
2527         {.i32 = static_cast<ArkUI_Int32>(false)}};
2528 
2529     if (item->size > NUM_0) {
2530         values[NUM_0].i32 = static_cast<ArkUI_Int32>(true);
2531         values[NUM_1].f32 = item->value[NUM_0].f32;
2532     }
2533 
2534     if (item->size > NUM_1) {
2535         values[NUM_3].i32 = static_cast<ArkUI_Int32>(true);
2536         values[NUM_4].f32 = item->value[NUM_1].f32;
2537     }
2538 
2539     if (item->size > NUM_2) {
2540         values[NUM_6].i32 = static_cast<ArkUI_Int32>(true);
2541         values[NUM_7].f32 = item->value[NUM_2].f32;
2542     }
2543 
2544     if (item->size > NUM_3) {
2545         values[NUM_8].i32 = static_cast<ArkUI_Int32>(true);
2546         values[NUM_9].f32 = item->value[NUM_3].f32;
2547     }
2548 
2549     if (item->size > NUM_4) {
2550         values[NUM_10].i32 = static_cast<ArkUI_Int32>(true);
2551         values[NUM_11].f32 = item->value[NUM_4].f32;
2552     }
2553 
2554     values[NUM_12].i32 = item->size > NUM_5 ? item->value[NUM_5].i32 : static_cast<ArkUI_Int32>(true);
2555 
2556     fullImpl->getNodeModifiers()->getCommonModifier()->setSweepGradient(
2557         node->uiNodeHandle, values, NUM_13, colors, size * NUM_3);
2558     return ERROR_CODE_NO_ERROR;
2559 }
2560 
ResetSweepGradient(ArkUI_NodeHandle node)2561 void ResetSweepGradient(ArkUI_NodeHandle node)
2562 {
2563     auto* fullImpl = GetFullImpl();
2564     fullImpl->getNodeModifiers()->getCommonModifier()->resetSweepGradient(node->uiNodeHandle);
2565 }
2566 
GetSweepGradient(ArkUI_NodeHandle node)2567 const ArkUI_AttributeItem* GetSweepGradient(ArkUI_NodeHandle node)
2568 {
2569     //default size 6
2570     ArkUI_Float32 values[NUM_6];
2571     //default size 10
2572     ArkUI_Uint32 colors[NUM_10];
2573     //default size 10
2574     ArkUI_Float32 stops[NUM_10];
2575     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2576     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getSweepGradient(
2577         node->uiNodeHandle, &values, &colors, &stops, unit);
2578     //centerX
2579     g_numberValues[NUM_0].f32 = values[NUM_0];
2580     //centerY
2581     g_numberValues[NUM_1].f32 = values[NUM_1];
2582     //startAngle
2583     g_numberValues[NUM_2].f32 = values[NUM_2];
2584     //endAngle
2585     g_numberValues[NUM_3].f32 = values[NUM_3];
2586     //rotation
2587     g_numberValues[NUM_4].f32 = values[NUM_4];
2588     //repeating
2589     g_numberValues[NUM_5].i32 = values[NUM_5];
2590     //size
2591     g_attributeItem.size = NUM_6;
2592     if (resultValue < NUM_1) {
2593         return &g_attributeItem;
2594     }
2595 
2596     static ArkUI_ColorStop colorStop;
2597     static uint32_t gradientColors[NUM_10];
2598     static float gradientStops[NUM_10];
2599     for (int i = 0; i < resultValue; i++) {
2600         gradientColors[i] = colors[i];
2601         gradientStops[i] = stops[i] / 100.0f; //百分比转换为小数
2602     }
2603     colorStop.colors = gradientColors;
2604     colorStop.stops = gradientStops;
2605     colorStop.size = resultValue;
2606     g_attributeItem.object = &colorStop;
2607     return &g_attributeItem;
2608 }
2609 
SetRadialGradient(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2610 int32_t SetRadialGradient(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2611 {
2612     if (item->size == 0) {
2613         return ERROR_CODE_PARAM_INVALID;
2614     }
2615     if (item->object == nullptr) {
2616         return ERROR_CODE_PARAM_INVALID;
2617     }
2618     auto* fullImpl = GetFullImpl();
2619     const ArkUI_ColorStop* colorStop = reinterpret_cast<ArkUI_ColorStop*>(item->object);
2620     int size = colorStop->size;
2621     ArkUIInt32orFloat32 colors[size * NUM_3];
2622     for (int i = 0; i < size; i++) {
2623         colors[i * NUM_3 + NUM_0].u32 = colorStop->colors[i];
2624         colors[i * NUM_3 + NUM_1].i32 = true;
2625         colors[i * NUM_3 + NUM_2].f32 = colorStop->stops[i];
2626     }
2627     int32_t unit = GetDefaultUnit(node, UNIT_VP);
2628     ArkUIInt32orFloat32 values[NUM_10] = {
2629         {.i32 = static_cast<ArkUI_Int32>(false) },
2630         {.f32 = static_cast<ArkUI_Float32>(DEFAULT_X) },
2631         {.i32 = static_cast<ArkUI_Float32>(unit) },
2632         {.i32 = static_cast<ArkUI_Int32>(false) },
2633         {.f32 = static_cast<ArkUI_Float32>(DEFAULT_Y) },
2634         {.i32 = static_cast<ArkUI_Float32>(unit) },
2635         {.i32 = static_cast<ArkUI_Int32>(false) },
2636         {.f32 = static_cast<ArkUI_Float32>(NUM_0) },
2637         {.i32 = static_cast<ArkUI_Float32>(unit) },
2638         {.i32 = static_cast<ArkUI_Int32>(false) }
2639     };
2640 
2641     if (item->size > NUM_0) {
2642         values[NUM_0].i32 = static_cast<ArkUI_Int32>(true);
2643         values[NUM_1].f32 = item->value[NUM_0].f32;
2644     }
2645 
2646     if (item->size > NUM_1) {
2647         values[NUM_3].i32 = static_cast<ArkUI_Int32>(true);
2648         values[NUM_4].f32 = item->value[NUM_1].f32;
2649     }
2650 
2651     if (item->size > NUM_2) {
2652         values[NUM_6].i32 = static_cast<ArkUI_Int32>(true);
2653         values[NUM_7].f32 = item->value[NUM_2].f32;
2654     }
2655 
2656     values[NUM_9].i32 = item->size > NUM_3 ? item->value[NUM_3].i32 : static_cast<ArkUI_Int32>(false);
2657     fullImpl->getNodeModifiers()->getCommonModifier()->setRadialGradient(
2658         node->uiNodeHandle, values, NUM_10, colors, size * NUM_3);
2659     return ERROR_CODE_NO_ERROR;
2660 }
2661 
ResetRadialGradient(ArkUI_NodeHandle node)2662 void ResetRadialGradient(ArkUI_NodeHandle node)
2663 {
2664     auto* fullImpl = GetFullImpl();
2665     fullImpl->getNodeModifiers()->getCommonModifier()->resetRadialGradient(node->uiNodeHandle);
2666 }
2667 
GetRadialGradient(ArkUI_NodeHandle node)2668 const ArkUI_AttributeItem* GetRadialGradient(ArkUI_NodeHandle node)
2669 {
2670     //default size 4
2671     ArkUI_Float32 values[NUM_4];
2672     //default size 10
2673     ArkUI_Uint32 colors[NUM_10];
2674     //default size 10
2675     ArkUI_Float32 stops[NUM_10];
2676 
2677     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2678     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getRadialGradient(
2679         node->uiNodeHandle, &values, &colors, &stops, unit);
2680     //centerX
2681     g_numberValues[NUM_0].f32 = values[NUM_0];
2682     //centerY
2683     g_numberValues[NUM_1].f32 = values[NUM_1];
2684     //radius
2685     g_numberValues[NUM_2].f32 = values[NUM_2];
2686     //repeating
2687     g_numberValues[NUM_3].i32 = values[NUM_3];
2688     //size
2689     g_attributeItem.size = NUM_3;
2690     if (resultValue < NUM_1) {
2691         return &g_attributeItem;
2692     }
2693 
2694     static ArkUI_ColorStop colorStop;
2695     static uint32_t gradientColors[NUM_10];
2696     static float gradientStops[NUM_10];
2697     for (int i = 0; i < resultValue; i++) {
2698         gradientColors[i] = colors[i];
2699         gradientStops[i] = stops[i] / 100.0f; //百分比转换为小数
2700     }
2701     colorStop.colors = gradientColors;
2702     colorStop.stops = gradientStops;
2703     colorStop.size = resultValue;
2704     g_attributeItem.object = &colorStop;
2705     return &g_attributeItem;
2706 }
2707 
SetMask(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2708 int32_t SetMask(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2709 {
2710     if (item->size < NUM_4) {
2711         return ERROR_CODE_PARAM_INVALID;
2712     }
2713     auto* fullImpl = GetFullImpl();
2714     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2715     if (item->value[NUM_3].i32 == ArkUI_MaskType::ARKUI_MASK_TYPE_PATH) {
2716         if (item->string == nullptr) {
2717             return ERROR_CODE_PARAM_INVALID;
2718         }
2719         auto fill = item->size > NUM_0 ? item->value[0].u32 : DEFAULT_FIll_COLOR;
2720         auto stroke = item->size > NUM_1 ? item->value[NUM_1].u32 : DEFAULT_FIll_COLOR;
2721         float strokeWidth = item->size > NUM_2 ? item->value[NUM_2].f32 : NUM_0;
2722         ArkUI_Float32 pathAttributes[NUM_2];
2723         if (item->size < NUM_5 || LessNotEqual(item->value[NUM_4].f32, 0.0f)) {
2724             return ERROR_CODE_PARAM_INVALID;
2725         }
2726         pathAttributes[NUM_0] = item->value[NUM_4].f32; // path width
2727         if (item->size < NUM_6 || LessNotEqual(item->value[NUM_5].f32, 0.0f)) {
2728             return ERROR_CODE_PARAM_INVALID;
2729         }
2730         pathAttributes[NUM_1] = item->value[NUM_5].f32; // path height
2731         fullImpl->getNodeModifiers()->getCommonModifier()->setMaskPath(
2732             node->uiNodeHandle, "path", fill, stroke, strokeWidth, &pathAttributes, item->string, unit);
2733     } else if (item->value[0].i32 == ArkUI_MaskType::ARKUI_MASK_TYPE_PROGRESS) {
2734         ArkUI_Float32 progressAttributes[NUM_2];
2735         if (LessNotEqual(item->value[NUM_1].f32, 0.0f) || LessNotEqual(item->value[NUM_2].f32, 0.0f)) {
2736             return ERROR_CODE_PARAM_INVALID;
2737         }
2738         progressAttributes[NUM_0] = item->value[NUM_1].f32; // value
2739         progressAttributes[NUM_1] = item->value[NUM_2].f32; // total
2740         uint32_t color = item->value[NUM_3].u32;
2741         fullImpl->getNodeModifiers()->getCommonModifier()->setProgressMask(
2742             node->uiNodeHandle, progressAttributes, color);
2743     } else {
2744         if (item->size < NUM_6) {
2745             return ERROR_CODE_PARAM_INVALID;
2746         }
2747         auto fill = item->size > NUM_0 ? item->value[0].u32 : DEFAULT_FIll_COLOR;
2748         auto stroke = item->size > NUM_1 ? item->value[NUM_1].u32 : DEFAULT_FIll_COLOR;
2749         float strokeWidth = item->size > NUM_2 ? item->value[NUM_2].f32 : NUM_0;
2750         auto index = item->size - NUM_4 < 0 ? 0 : item->size - NUM_4;
2751         ArkUI_Float32 attributes[index];
2752         for (int i = 0; i < index; i++) {
2753             if (LessNotEqual(item->value[i + NUM_4].f32, 0.0f)) {
2754                 return ERROR_CODE_PARAM_INVALID;
2755             } else {
2756                 attributes[i] = item->value[i + NUM_4].f32;
2757             }
2758         }
2759         fullImpl->getNodeModifiers()->getCommonModifier()->setMaskShape(node->uiNodeHandle,
2760             ShapeToString(item->value[NUM_3].i32).c_str(), fill, stroke, strokeWidth, attributes, item->size - NUM_4,
2761             unit);
2762     }
2763     return ERROR_CODE_NO_ERROR;
2764 }
2765 
ResetMask(ArkUI_NodeHandle node)2766 void ResetMask(ArkUI_NodeHandle node)
2767 {
2768     auto* fullImpl = GetFullImpl();
2769     fullImpl->getNodeModifiers()->getCommonModifier()->resetMask(node->uiNodeHandle);
2770 }
2771 
GetMask(ArkUI_NodeHandle node)2772 const ArkUI_AttributeItem* GetMask(ArkUI_NodeHandle node)
2773 {
2774     ArkUIMaskOptions options;
2775     auto unit = GetDefaultUnit(node, UNIT_VP);
2776     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getMask(node->uiNodeHandle, &options, unit);
2777     CHECK_NULL_RETURN(&options, nullptr);
2778     if (options.type == static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_PROGRESS)) {
2779         g_numberValues[NUM_0].i32 = options.type;
2780         g_numberValues[NUM_1].f32 = options.value;
2781         g_numberValues[NUM_2].f32 = options.maxValue;
2782         g_numberValues[NUM_3].u32 = options.color;
2783         return &g_attributeItem;
2784     }
2785     switch (static_cast<BasicShapeType>(options.type)) {
2786         case BasicShapeType::RECT:
2787             g_numberValues[NUM_0].u32 = options.fill;
2788             g_numberValues[NUM_1].u32 = options.strokeColor;
2789             g_numberValues[NUM_2].f32 = options.strokeWidth;
2790             g_numberValues[NUM_3].i32 = static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_RECTANGLE);
2791             g_numberValues[NUM_4].f32 = options.width;
2792             g_numberValues[NUM_5].f32 = options.height;
2793             g_numberValues[NUM_6].f32 = options.radiusWidth;
2794             g_numberValues[NUM_7].f32 = options.radiusHeight;
2795             g_numberValues[NUM_8].f32 = options.topLeftRadius;
2796             g_numberValues[NUM_9].f32 = options.bottomLeftRadius;
2797             g_numberValues[NUM_10].f32 = options.topRightRadius;
2798             g_numberValues[NUM_11].f32 = options.bottomRightRadius;
2799             break;
2800         case BasicShapeType::CIRCLE:
2801             g_numberValues[NUM_0].u32 = options.fill;
2802             g_numberValues[NUM_1].u32 = options.strokeColor;
2803             g_numberValues[NUM_2].f32 = options.strokeWidth;
2804             g_numberValues[NUM_3].i32 = static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_CIRCLE);
2805             g_numberValues[NUM_4].f32 = options.width;
2806             g_numberValues[NUM_5].f32 = options.height;
2807             break;
2808         case BasicShapeType::ELLIPSE:
2809             g_numberValues[NUM_0].u32 = options.fill;
2810             g_numberValues[NUM_1].u32 = options.strokeColor;
2811             g_numberValues[NUM_2].f32 = options.strokeWidth;
2812             g_numberValues[NUM_3].i32 = static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_ELLIPSE);
2813             g_numberValues[NUM_4].f32 = options.width;
2814             g_numberValues[NUM_5].f32 = options.height;
2815             break;
2816 
2817         case BasicShapeType::PATH:
2818             g_numberValues[NUM_0].u32 = options.fill;
2819             g_numberValues[NUM_1].u32 = options.strokeColor;
2820             g_numberValues[NUM_2].f32 = options.strokeWidth;
2821             g_numberValues[NUM_3].i32 = static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_PATH);
2822             g_numberValues[NUM_4].f32 = options.width;
2823             g_numberValues[NUM_5].f32 = options.height;
2824             g_attributeItem.string = options.commands;
2825             break;
2826         default:
2827             return nullptr;
2828     }
2829     return &g_attributeItem;
2830 }
2831 
SetBlendMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2832 int32_t SetBlendMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2833 {
2834     if (item->size == 0) {
2835         return ERROR_CODE_PARAM_INVALID;
2836     }
2837     if (!InRegion(NUM_0, NUM_29, item->value[NUM_0].i32) || !InRegion(NUM_0, NUM_1, item->value[NUM_1].i32)) {
2838         return ERROR_CODE_PARAM_INVALID;
2839     }
2840 
2841     auto* fullImpl = GetFullImpl();
2842     int blendMode = item->value[0].i32;
2843     int blendApplyType = NUM_0;
2844     if (item->size > NUM_1) {
2845         blendApplyType = item->value[1].i32;
2846     }
2847     fullImpl->getNodeModifiers()->getCommonModifier()->setBlendMode(node->uiNodeHandle, blendMode, blendApplyType);
2848     return ERROR_CODE_NO_ERROR;
2849 }
2850 
ResetBlendMode(ArkUI_NodeHandle node)2851 void ResetBlendMode(ArkUI_NodeHandle node)
2852 {
2853     auto* fullImpl = GetFullImpl();
2854     fullImpl->getNodeModifiers()->getCommonModifier()->resetBlendMode(node->uiNodeHandle);
2855 }
2856 
GetBlendMode(ArkUI_NodeHandle node)2857 const ArkUI_AttributeItem* GetBlendMode(ArkUI_NodeHandle node)
2858 {
2859     ArkUIBlendModeOptions options;
2860     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getBlendMode(node->uiNodeHandle, &options);
2861     g_numberValues[NUM_0].i32 = options.blendMode;
2862     g_numberValues[NUM_1].i32 = options.blendApplyType;
2863     return &g_attributeItem;
2864 }
2865 
SetDirection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2866 int32_t SetDirection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2867 {
2868     if (item->size == 0) {
2869         return ERROR_CODE_PARAM_INVALID;
2870     }
2871     if (item->value[0].i32 < ArkUI_Direction::ARKUI_DIRECTION_LTR ||
2872         item->value[0].i32 > ArkUI_Direction::ARKUI_DIRECTION_AUTO) {
2873         return ERROR_CODE_PARAM_INVALID;
2874     }
2875     auto* fullImpl = GetFullImpl();
2876     fullImpl->getNodeModifiers()->getCommonModifier()->setDirection(node->uiNodeHandle, item->value[0].i32);
2877     return ERROR_CODE_NO_ERROR;
2878 }
2879 
ResetDirection(ArkUI_NodeHandle node)2880 void ResetDirection(ArkUI_NodeHandle node)
2881 {
2882     auto* fullImpl = GetFullImpl();
2883     fullImpl->getNodeModifiers()->getCommonModifier()->resetDirection(node->uiNodeHandle);
2884 }
2885 
GetDirection(ArkUI_NodeHandle node)2886 const ArkUI_AttributeItem* GetDirection(ArkUI_NodeHandle node)
2887 {
2888     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2889     g_numberValues[0].i32 = modifier->getDirection(node->uiNodeHandle);
2890     return &g_attributeItem;
2891 }
2892 
SetAlignSelf(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2893 int32_t SetAlignSelf(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2894 {
2895     if (item->size == 0) {
2896         return ERROR_CODE_PARAM_INVALID;
2897     }
2898     if (item->value[0].i32 < ArkUI_ItemAlignment::ARKUI_ITEM_ALIGNMENT_AUTO ||
2899         item->value[0].i32 > ArkUI_ItemAlignment::ARKUI_ITEM_ALIGNMENT_BASELINE) {
2900         return ERROR_CODE_PARAM_INVALID;
2901     }
2902     auto* fullImpl = GetFullImpl();
2903     fullImpl->getNodeModifiers()->getCommonModifier()->setAlignSelf(node->uiNodeHandle, item->value[0].i32);
2904     return ERROR_CODE_NO_ERROR;
2905 }
2906 
ResetAlignSelf(ArkUI_NodeHandle node)2907 void ResetAlignSelf(ArkUI_NodeHandle node)
2908 {
2909     auto* fullImpl = GetFullImpl();
2910     fullImpl->getNodeModifiers()->getCommonModifier()->resetAlignSelf(node->uiNodeHandle);
2911 }
2912 
GetAlignSelf(ArkUI_NodeHandle node)2913 const ArkUI_AttributeItem* GetAlignSelf(ArkUI_NodeHandle node)
2914 {
2915     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2916     g_numberValues[0].i32 = modifier->getAlignSelf(node->uiNodeHandle);
2917     return &g_attributeItem;
2918 }
2919 
SetFlexGrow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2920 int32_t SetFlexGrow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2921 {
2922     if (item->size == 0) {
2923         return ERROR_CODE_PARAM_INVALID;
2924     }
2925     if (LessNotEqual(item->value[0].f32, 0.0f)) {
2926         return ERROR_CODE_PARAM_INVALID;
2927     }
2928     auto fullImpl = GetFullImpl();
2929     fullImpl->getNodeModifiers()->getCommonModifier()->setFlexGrow(node->uiNodeHandle, item->value[0].f32);
2930     return ERROR_CODE_NO_ERROR;
2931 }
2932 
ResetFlexGrow(ArkUI_NodeHandle node)2933 void ResetFlexGrow(ArkUI_NodeHandle node)
2934 {
2935     auto* fullImpl = GetFullImpl();
2936     fullImpl->getNodeModifiers()->getCommonModifier()->resetFlexGrow(node->uiNodeHandle);
2937 }
2938 
GetFlexGrow(ArkUI_NodeHandle node)2939 const ArkUI_AttributeItem* GetFlexGrow(ArkUI_NodeHandle node)
2940 {
2941     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2942     g_numberValues[0].f32 = modifier->getFlexGrow(node->uiNodeHandle);
2943     return &g_attributeItem;
2944 }
2945 
SetFlexShrink(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2946 int32_t SetFlexShrink(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2947 {
2948     if (item->size == 0) {
2949         return ERROR_CODE_PARAM_INVALID;
2950     }
2951     if (LessNotEqual(item->value[0].f32, 0.0f)) {
2952         return ERROR_CODE_PARAM_INVALID;
2953     }
2954     auto fullImpl = GetFullImpl();
2955     fullImpl->getNodeModifiers()->getCommonModifier()->setFlexShrink(node->uiNodeHandle, item->value[0].f32);
2956     return ERROR_CODE_NO_ERROR;
2957 }
2958 
ResetFlexShrink(ArkUI_NodeHandle node)2959 void ResetFlexShrink(ArkUI_NodeHandle node)
2960 {
2961     auto* fullImpl = GetFullImpl();
2962     fullImpl->getNodeModifiers()->getCommonModifier()->resetFlexShrink(node->uiNodeHandle);
2963 }
2964 
GetFlexShrink(ArkUI_NodeHandle node)2965 const ArkUI_AttributeItem* GetFlexShrink(ArkUI_NodeHandle node)
2966 {
2967     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2968     g_numberValues[0].f32 = modifier->getFlexShrink(node->uiNodeHandle);
2969     return &g_attributeItem;
2970 }
2971 
SetFlexBasis(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2972 int32_t SetFlexBasis(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2973 {
2974     if (item->size == 0) {
2975         return ERROR_CODE_PARAM_INVALID;
2976     }
2977     if (LessNotEqual(item->value[0].f32, 0.0f)) {
2978         return ERROR_CODE_PARAM_INVALID;
2979     }
2980     auto fullImpl = GetFullImpl();
2981     struct ArkUIStringAndFloat basis = { item->value[0].f32, nullptr };
2982     fullImpl->getNodeModifiers()->getCommonModifier()->setFlexBasis(node->uiNodeHandle, &basis);
2983     return ERROR_CODE_NO_ERROR;
2984 }
2985 
ResetFlexBasis(ArkUI_NodeHandle node)2986 void ResetFlexBasis(ArkUI_NodeHandle node)
2987 {
2988     auto* fullImpl = GetFullImpl();
2989     fullImpl->getNodeModifiers()->getCommonModifier()->resetFlexBasis(node->uiNodeHandle);
2990 }
2991 
GetFlexBasis(ArkUI_NodeHandle node)2992 const ArkUI_AttributeItem* GetFlexBasis(ArkUI_NodeHandle node)
2993 {
2994     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2995     g_numberValues[0].f32 = modifier->getFlexBasis(node->uiNodeHandle);
2996     return &g_attributeItem;
2997 }
2998 
SetConstraintSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2999 int32_t SetConstraintSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3000 {
3001     if (item->size == 0 || item->size != ALLOW_SIZE_4) {
3002         return ERROR_CODE_PARAM_INVALID;
3003     }
3004 
3005     auto* fullImpl = GetFullImpl();
3006     ArkUI_Float32 constraintSize[ALLOW_SIZE_4] = { 0.0f, FLT_MAX, 0.0f, FLT_MAX };
3007     int32_t unit = GetDefaultUnit(node, UNIT_VP);
3008     ArkUI_Int32 units[ALLOW_SIZE_4] = { unit, unit, unit, unit };
3009 
3010     for (int i = 0; i < ALLOW_SIZE_4; ++i) {
3011         if (LessNotEqual(item->value[i].f32, 0.0f)) {
3012             return ERROR_CODE_PARAM_INVALID;
3013         } else {
3014             constraintSize[i] = item->value[i].f32;
3015         }
3016     }
3017 
3018     fullImpl->getNodeModifiers()->getCommonModifier()->setConstraintSize(node->uiNodeHandle, constraintSize, units);
3019     return ERROR_CODE_NO_ERROR;
3020 }
3021 
ResetConstraintSize(ArkUI_NodeHandle node)3022 void ResetConstraintSize(ArkUI_NodeHandle node)
3023 {
3024     auto* fullImpl = GetFullImpl();
3025     fullImpl->getNodeModifiers()->getCommonModifier()->resetConstraintSize(node->uiNodeHandle);
3026 }
3027 
GetConstraintSize(ArkUI_NodeHandle node)3028 const ArkUI_AttributeItem* GetConstraintSize(ArkUI_NodeHandle node)
3029 {
3030     ArkUIConstraintSizeOptions options;
3031     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
3032     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getConstraintSize(node->uiNodeHandle, &options, unit);
3033     g_numberValues[NUM_0].f32 = options.minWidth;
3034     g_numberValues[NUM_1].f32 = options.maxWidth;
3035     g_numberValues[NUM_2].f32 = options.minHeight;
3036     g_numberValues[NUM_3].f32 = options.maxHeight;
3037     return &g_attributeItem;
3038 }
3039 
SetGrayscale(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3040 int32_t SetGrayscale(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3041 {
3042     if (item->size == 0) {
3043         return ERROR_CODE_PARAM_INVALID;
3044     }
3045     if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
3046         return ERROR_CODE_PARAM_INVALID;
3047     }
3048     auto* fullImpl = GetFullImpl();
3049     fullImpl->getNodeModifiers()->getCommonModifier()->setGrayscale(node->uiNodeHandle, item->value[0].f32);
3050     return ERROR_CODE_NO_ERROR;
3051 }
3052 
ResetGrayscale(ArkUI_NodeHandle node)3053 void ResetGrayscale(ArkUI_NodeHandle node)
3054 {
3055     auto* fullImpl = GetFullImpl();
3056     fullImpl->getNodeModifiers()->getCommonModifier()->resetGrayscale(node->uiNodeHandle);
3057 }
3058 
GetGrayscale(ArkUI_NodeHandle node)3059 const ArkUI_AttributeItem* GetGrayscale(ArkUI_NodeHandle node)
3060 {
3061     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3062     g_numberValues[0].f32 = modifier->getGrayScale(node->uiNodeHandle);
3063     return &g_attributeItem;
3064 }
3065 
SetInvert(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3066 int32_t SetInvert(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3067 {
3068     if (item->size == 0) {
3069         return ERROR_CODE_PARAM_INVALID;
3070     }
3071     if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
3072         return ERROR_CODE_PARAM_INVALID;
3073     }
3074     auto fullImpl = GetFullImpl();
3075     ArkUI_Float32 invert[] = { item->value[0].f32 };
3076     fullImpl->getNodeModifiers()->getCommonModifier()->setInvert(node->uiNodeHandle, invert, NUM_1);
3077     return ERROR_CODE_NO_ERROR;
3078 }
3079 
ResetInvert(ArkUI_NodeHandle node)3080 void ResetInvert(ArkUI_NodeHandle node)
3081 {
3082     auto* fullImpl = GetFullImpl();
3083     fullImpl->getNodeModifiers()->getCommonModifier()->resetInvert(node->uiNodeHandle);
3084 }
3085 
GetInvert(ArkUI_NodeHandle node)3086 const ArkUI_AttributeItem* GetInvert(ArkUI_NodeHandle node)
3087 {
3088     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3089     g_numberValues[0].f32 = modifier->getInvert(node->uiNodeHandle);
3090     return &g_attributeItem;
3091 }
3092 
SetSepia(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3093 int32_t SetSepia(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3094 {
3095     if (item->size == 0) {
3096         return ERROR_CODE_PARAM_INVALID;
3097     }
3098     if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
3099         return ERROR_CODE_PARAM_INVALID;
3100     }
3101     auto* fullImpl = GetFullImpl();
3102     fullImpl->getNodeModifiers()->getCommonModifier()->setSepia(node->uiNodeHandle, item->value[0].f32);
3103     return ERROR_CODE_NO_ERROR;
3104 }
3105 
ResetSepia(ArkUI_NodeHandle node)3106 void ResetSepia(ArkUI_NodeHandle node)
3107 {
3108     auto* fullImpl = GetFullImpl();
3109     fullImpl->getNodeModifiers()->getCommonModifier()->resetSepia(node->uiNodeHandle);
3110 }
3111 
GetSepia(ArkUI_NodeHandle node)3112 const ArkUI_AttributeItem* GetSepia(ArkUI_NodeHandle node)
3113 {
3114     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3115     g_numberValues[0].f32 = modifier->getSepia(node->uiNodeHandle);
3116     return &g_attributeItem;
3117 }
3118 
SetContrast(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3119 int32_t SetContrast(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3120 {
3121     if (item->size == 0) {
3122         return ERROR_CODE_PARAM_INVALID;
3123     }
3124     if (LessNotEqual(item->value[0].f32, 0.0f) || GreatOrEqual(item->value[0].f32, 10.0f)) {
3125         return ERROR_CODE_PARAM_INVALID;
3126     }
3127     auto* fullImpl = GetFullImpl();
3128     fullImpl->getNodeModifiers()->getCommonModifier()->setContrast(node->uiNodeHandle, item->value[0].f32);
3129     return ERROR_CODE_NO_ERROR;
3130 }
3131 
ResetContrast(ArkUI_NodeHandle node)3132 void ResetContrast(ArkUI_NodeHandle node)
3133 {
3134     auto* fullImpl = GetFullImpl();
3135     fullImpl->getNodeModifiers()->getCommonModifier()->resetContrast(node->uiNodeHandle);
3136 }
3137 
GetContrast(ArkUI_NodeHandle node)3138 const ArkUI_AttributeItem* GetContrast(ArkUI_NodeHandle node)
3139 {
3140     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3141     g_numberValues[0].f32 = modifier->getContrast(node->uiNodeHandle);
3142     return &g_attributeItem;
3143 }
3144 
SetForegroundColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3145 int32_t SetForegroundColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3146 {
3147     if (item->size == 0) {
3148         return ERROR_CODE_PARAM_INVALID;
3149     }
3150     auto* fullImpl = GetFullImpl();
3151     bool isColor = true;
3152     if (item->value[0].i32 == ArkUI_ColorStrategy::ARKUI_COLOR_STRATEGY_INVERT ||
3153         item->value[0].i32 == ArkUI_ColorStrategy::ARKUI_COLOR_STRATEGY_AVERAGE ||
3154         item->value[0].i32 == ArkUI_ColorStrategy::ARKUI_COLOR_STRATEGY_PRIMARY) {
3155         isColor = false;
3156         fullImpl->getNodeModifiers()->getCommonModifier()->setForegroundColor(
3157             node->uiNodeHandle, isColor, item->value[0].i32);
3158     } else {
3159         isColor = true;
3160         fullImpl->getNodeModifiers()->getCommonModifier()->setForegroundColor(
3161             node->uiNodeHandle, isColor, item->value[0].u32);
3162     }
3163     return ERROR_CODE_NO_ERROR;
3164 }
3165 
ResetForegroundColor(ArkUI_NodeHandle node)3166 void ResetForegroundColor(ArkUI_NodeHandle node)
3167 {
3168     auto* fullImpl = GetFullImpl();
3169     fullImpl->getNodeModifiers()->getCommonModifier()->resetForegroundColor(node->uiNodeHandle);
3170 }
3171 
GetForegroundColor(ArkUI_NodeHandle node)3172 const ArkUI_AttributeItem* GetForegroundColor(ArkUI_NodeHandle node)
3173 {
3174     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3175     g_numberValues[0].u32 = modifier->getForegroundColor(node->uiNodeHandle);
3176     return &g_attributeItem;
3177 }
3178 
SetNeedFocus(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3179 int32_t SetNeedFocus(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3180 {
3181     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
3182         return ERROR_CODE_PARAM_INVALID;
3183     }
3184     GetFullImpl()->getNodeModifiers()->getCommonModifier()->setNeedFocus(
3185         node->uiNodeHandle, item->value[0].i32);
3186     return ERROR_CODE_NO_ERROR;
3187 }
3188 
GetNeedFocus(ArkUI_NodeHandle node)3189 const ArkUI_AttributeItem* GetNeedFocus(ArkUI_NodeHandle node)
3190 {
3191     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getNeedFocus(node->uiNodeHandle);
3192     g_numberValues[0].i32 = resultValue;
3193     return &g_attributeItem;
3194 }
3195 
SetAspectRatio(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3196 int32_t SetAspectRatio(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3197 {
3198     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3199     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
3200         return ERROR_CODE_PARAM_INVALID;
3201     }
3202     auto* fullImpl = GetFullImpl();
3203     fullImpl->getNodeModifiers()->getCommonModifier()->setAspectRatio(node->uiNodeHandle, item->value[NUM_0].f32);
3204     return ERROR_CODE_NO_ERROR;
3205 }
3206 
ResetAspectRatio(ArkUI_NodeHandle node)3207 void ResetAspectRatio(ArkUI_NodeHandle node)
3208 {
3209     auto* fullImpl = GetFullImpl();
3210     fullImpl->getNodeModifiers()->getCommonModifier()->resetAspectRatio(node->uiNodeHandle);
3211 }
3212 
GetAspectRatio(ArkUI_NodeHandle node)3213 const ArkUI_AttributeItem* GetAspectRatio(ArkUI_NodeHandle node)
3214 {
3215     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3216     g_numberValues[0].f32 = modifier->getAspectRatio(node->uiNodeHandle);
3217     return &g_attributeItem;
3218 }
3219 
SetLayoutWeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3220 int32_t SetLayoutWeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3221 {
3222     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3223     if (actualSize < 0) {
3224         return ERROR_CODE_PARAM_INVALID;
3225     }
3226     auto* fullImpl = GetFullImpl();
3227     fullImpl->getNodeModifiers()->getCommonModifier()->setLayoutWeight(node->uiNodeHandle, item->value[0].u32);
3228     return ERROR_CODE_NO_ERROR;
3229 }
3230 
ResetLayoutWeight(ArkUI_NodeHandle node)3231 void ResetLayoutWeight(ArkUI_NodeHandle node)
3232 {
3233     auto* fullImpl = GetFullImpl();
3234     fullImpl->getNodeModifiers()->getCommonModifier()->resetLayoutWeight(node->uiNodeHandle);
3235 }
3236 
GetLayoutWeight(ArkUI_NodeHandle node)3237 const ArkUI_AttributeItem* GetLayoutWeight(ArkUI_NodeHandle node)
3238 {
3239     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3240     g_numberValues[0].u32 = static_cast<uint32_t>(modifier->getLayoutWeight(node->uiNodeHandle));
3241     g_attributeItem.size = REQUIRED_ONE_PARAM;
3242     return &g_attributeItem;
3243 }
3244 
SetDisplayPriority(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3245 int32_t SetDisplayPriority(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3246 {
3247     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3248     if (actualSize < 0) {
3249         return ERROR_CODE_PARAM_INVALID;
3250     }
3251     auto* fullImpl = GetFullImpl();
3252     fullImpl->getNodeModifiers()->getCommonModifier()->setDisplayPriority(node->uiNodeHandle, item->value[0].u32);
3253     return ERROR_CODE_NO_ERROR;
3254 }
3255 
ResetDisplayPriority(ArkUI_NodeHandle node)3256 void ResetDisplayPriority(ArkUI_NodeHandle node)
3257 {
3258     auto* fullImpl = GetFullImpl();
3259     fullImpl->getNodeModifiers()->getCommonModifier()->setDisplayPriority(node->uiNodeHandle, 0);
3260 }
3261 
GetDisplayPriority(ArkUI_NodeHandle node)3262 const ArkUI_AttributeItem* GetDisplayPriority(ArkUI_NodeHandle node)
3263 {
3264     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3265     if (!modifier) {
3266         return nullptr;
3267     }
3268     g_numberValues[0].u32 = static_cast<uint32_t>(modifier->getDisplayPriority(node->uiNodeHandle));
3269     g_attributeItem.size = REQUIRED_ONE_PARAM;
3270     return &g_attributeItem;
3271 }
3272 
SetOutlineWidth(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3273 int32_t SetOutlineWidth(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3274 {
3275     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
3276     if (actualSize < 0) {
3277         return ERROR_CODE_PARAM_INVALID;
3278     }
3279     auto* fullImpl = GetFullImpl();
3280     fullImpl->getNodeModifiers()->getCommonModifier()->setOutlineWidthFloat(node->uiNodeHandle,
3281         item->value[OUTLINE_LEFT_WIDTH_INDEX].f32, item->value[OUTLINE_TOP_WIDTH_INDEX].f32,
3282         item->value[OUTLINE_RIGHT_WIDTH_INDEX].f32, item->value[OUTLINE_BOTTOM_WIDTH_INDEX].f32);
3283     return ERROR_CODE_NO_ERROR;
3284 }
3285 
ResetOutlineWidth(ArkUI_NodeHandle node)3286 void ResetOutlineWidth(ArkUI_NodeHandle node)
3287 {
3288     auto* fullImpl = GetFullImpl();
3289     fullImpl->getNodeModifiers()->getCommonModifier()->setOutlineWidthFloat(node->uiNodeHandle,
3290         0.0f, 0.0f, 0.0f, 0.0f);
3291 }
3292 
GetOutlineWidth(ArkUI_NodeHandle node)3293 const ArkUI_AttributeItem* GetOutlineWidth(ArkUI_NodeHandle node)
3294 {
3295     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3296     if (!modifier) {
3297         return nullptr;
3298     }
3299     std::array<float, REQUIRED_FOUR_PARAM> outlineWidthArray;
3300     modifier->getOutlineWidthFloat(node->uiNodeHandle, &outlineWidthArray[0], REQUIRED_FOUR_PARAM);
3301     g_numberValues[OUTLINE_LEFT_WIDTH_INDEX].f32 = outlineWidthArray[OUTLINE_LEFT_WIDTH_INDEX];
3302     g_numberValues[OUTLINE_TOP_WIDTH_INDEX].f32 = outlineWidthArray[OUTLINE_TOP_WIDTH_INDEX];
3303     g_numberValues[OUTLINE_RIGHT_WIDTH_INDEX].f32 = outlineWidthArray[OUTLINE_RIGHT_WIDTH_INDEX];
3304     g_numberValues[OUTLINE_BOTTOM_WIDTH_INDEX].f32 = outlineWidthArray[OUTLINE_BOTTOM_WIDTH_INDEX];
3305     g_attributeItem.size = REQUIRED_FOUR_PARAM;
3306     return &g_attributeItem;
3307 }
3308 
SetGeometryTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3309 int32_t SetGeometryTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3310 {
3311     if (item->string == nullptr) {
3312         return ERROR_CODE_PARAM_INVALID;
3313     }
3314     ArkUIGeometryTransitionOptions options;
3315     ArkUI_Bool follow = false;
3316     if (item->size == 1) {
3317         follow = item->value[0].i32;
3318     }
3319     options.follow = follow;
3320     options.hierarchyStrategy = static_cast<int32_t>(TransitionHierarchyStrategy::ADAPTIVE);
3321 
3322     auto* fullImpl = GetFullImpl();
3323     fullImpl->getNodeModifiers()->getCommonModifier()->setGeometryTransition(node->uiNodeHandle, item->string,
3324         &options);
3325     return ERROR_CODE_NO_ERROR;
3326 }
3327 
ResetGeometryTransition(ArkUI_NodeHandle node)3328 void ResetGeometryTransition(ArkUI_NodeHandle node)
3329 {
3330     auto* fullImpl = GetFullImpl();
3331     fullImpl->getNodeModifiers()->getCommonModifier()->resetGeometryTransition(node->uiNodeHandle);
3332 }
3333 
GetGeometryTransition(ArkUI_NodeHandle node)3334 const ArkUI_AttributeItem* GetGeometryTransition(ArkUI_NodeHandle node)
3335 {
3336     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3337     if (!modifier) {
3338         return nullptr;
3339     }
3340     ArkUIGeometryTransitionOptions options;
3341     g_attributeItem.string = modifier->getGeometryTransition(node->uiNodeHandle, &options);
3342     g_numberValues[NUM_0].i32 = options.follow;
3343     g_numberValues[NUM_1].i32 = options.hierarchyStrategy;
3344     return &g_attributeItem;
3345 }
3346 
SetChainMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3347 int32_t SetChainMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3348 {
3349     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
3350     if (actualSize < 0 || !CheckAttributeIsAxis(item->value[0].i32) ||
3351         !CheckAttributeIsChainStyle(item->value[1].i32)) {
3352         return ERROR_CODE_PARAM_INVALID;
3353     }
3354     auto* fullImpl = GetFullImpl();
3355     //index 0 direction  index 1 style
3356     fullImpl->getNodeModifiers()->getCommonModifier()->setChainStyle(
3357         node->uiNodeHandle, item->value[0].i32, item->value[1].i32);
3358     return ERROR_CODE_NO_ERROR;
3359 }
3360 
ResetChainMode(ArkUI_NodeHandle node)3361 void ResetChainMode(ArkUI_NodeHandle node)
3362 {
3363     auto* fullImpl = GetFullImpl();
3364     fullImpl->getNodeModifiers()->getCommonModifier()->resetChainStyle(node->uiNodeHandle);
3365 }
3366 
GetChainMode(ArkUI_NodeHandle node)3367 const ArkUI_AttributeItem* GetChainMode(ArkUI_NodeHandle node)
3368 {
3369     //size = 2; direction and style
3370     ArkUI_Int32 values[ALLOW_SIZE_2];
3371     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getChainStyle(node->uiNodeHandle, &values);
3372     //index 0 direction
3373     g_numberValues[0].i32 = values[0];
3374     //index 1 style
3375     g_numberValues[1].i32 = values[1];
3376     g_attributeItem.size = ALLOW_SIZE_2;
3377 
3378     return &g_attributeItem;
3379 }
3380 
SetWidthPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3381 int32_t SetWidthPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3382 {
3383     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3384     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
3385         return ERROR_CODE_PARAM_INVALID;
3386     }
3387     auto* fullImpl = GetFullImpl();
3388     fullImpl->getNodeModifiers()->getCommonModifier()->setWidth(
3389         node->uiNodeHandle, item->value[NUM_0].f32, UNIT_PERCENT, nullptr);
3390     return ERROR_CODE_NO_ERROR;
3391 }
3392 
ResetWidthPercent(ArkUI_NodeHandle node)3393 void ResetWidthPercent(ArkUI_NodeHandle node)
3394 {
3395     ResetWidth(node);
3396 }
3397 
GetWidthPercent(ArkUI_NodeHandle node)3398 const ArkUI_AttributeItem* GetWidthPercent(ArkUI_NodeHandle node)
3399 {
3400     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3401     g_numberValues[0].f32 = modifier->getWidth(node->uiNodeHandle, UNIT_PERCENT);
3402     if (LessNotEqual(g_numberValues[0].f32, 0.0f)) {
3403         return nullptr;
3404     }
3405     return &g_attributeItem;
3406 }
3407 
SetHeightPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3408 int32_t SetHeightPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3409 {
3410     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3411     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
3412         return ERROR_CODE_PARAM_INVALID;
3413     }
3414     auto* fullImpl = GetFullImpl();
3415     fullImpl->getNodeModifiers()->getCommonModifier()->setHeight(
3416         node->uiNodeHandle, item->value[NUM_0].f32, UNIT_PERCENT, nullptr);
3417     return ERROR_CODE_NO_ERROR;
3418 }
3419 
ResetHeightPercent(ArkUI_NodeHandle node)3420 void ResetHeightPercent(ArkUI_NodeHandle node)
3421 {
3422     ResetHeight(node);
3423 }
3424 
GetHeightPercent(ArkUI_NodeHandle node)3425 const ArkUI_AttributeItem* GetHeightPercent(ArkUI_NodeHandle node)
3426 {
3427     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3428     g_numberValues[0].f32 = modifier->getHeight(node->uiNodeHandle, UNIT_PERCENT);
3429     if (LessNotEqual(g_numberValues[0].f32, 0.0f)) {
3430         return nullptr;
3431     }
3432     return &g_attributeItem;
3433 }
3434 
SetPaddingPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3435 int32_t SetPaddingPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3436 {
3437     if (item->size != NUM_1 && item->size != NUM_4) {
3438         return ERROR_CODE_PARAM_INVALID;
3439     }
3440     auto* fullImpl = GetFullImpl();
3441     int topIndex = NUM_0;
3442     int rightIndex = item->size == NUM_1 ? NUM_0 : NUM_1;
3443     int bottomIndex = item->size == NUM_1 ? NUM_0 : NUM_2;
3444     int leftIndex = item->size == NUM_1 ? NUM_0 : NUM_3;
3445     struct ArkUISizeType top = { item->value[topIndex].f32, UNIT_PERCENT };
3446     struct ArkUISizeType right = { item->value[rightIndex].f32, UNIT_PERCENT };
3447     struct ArkUISizeType bottom = { item->value[bottomIndex].f32, UNIT_PERCENT };
3448     struct ArkUISizeType left = { item->value[leftIndex].f32, UNIT_PERCENT };
3449     fullImpl->getNodeModifiers()->getCommonModifier()->setPadding(node->uiNodeHandle, &top, &right, &bottom, &left);
3450     return ERROR_CODE_NO_ERROR;
3451 }
3452 
ResetPaddingPercent(ArkUI_NodeHandle node)3453 void ResetPaddingPercent(ArkUI_NodeHandle node)
3454 {
3455     ResetPadding(node);
3456 }
3457 
GetPaddingPercent(ArkUI_NodeHandle node)3458 const ArkUI_AttributeItem* GetPaddingPercent(ArkUI_NodeHandle node)
3459 {
3460     auto* fullImpl = GetFullImpl();
3461     ArkUI_Float32 paddings[NUM_4];
3462     ArkUI_Int32 length = 0;
3463     fullImpl->getNodeModifiers()->getCommonModifier()->getPadding(node->uiNodeHandle, &paddings, length, UNIT_PERCENT);
3464     g_numberValues[NUM_0].f32 = paddings[NUM_0];
3465     g_numberValues[NUM_1].f32 = paddings[NUM_1];
3466     g_numberValues[NUM_2].f32 = paddings[NUM_2];
3467     g_numberValues[NUM_3].f32 = paddings[NUM_3];
3468     return &g_attributeItem;
3469 }
3470 
SetMarginPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3471 int32_t SetMarginPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3472 {
3473     if (!item || (item->size != NUM_4 && item->size != NUM_1)) {
3474         return ERROR_CODE_PARAM_INVALID;
3475     }
3476     auto* fullImpl = GetFullImpl();
3477     int topIndex = NUM_0;
3478     int rightIndex = item->size == NUM_1 ? NUM_0 : NUM_1;
3479     int bottomIndex = item->size == NUM_1 ? NUM_0 : NUM_2;
3480     int leftIndex = item->size == NUM_1 ? NUM_0 : NUM_3;
3481     struct ArkUISizeType top = { item->value[topIndex].f32, UNIT_PERCENT };
3482     struct ArkUISizeType right = { item->value[rightIndex].f32, UNIT_PERCENT };
3483     struct ArkUISizeType bottom = { item->value[bottomIndex].f32, UNIT_PERCENT };
3484     struct ArkUISizeType left = { item->value[leftIndex].f32, UNIT_PERCENT };
3485     if (node->type == ARKUI_NODE_TEXT_INPUT) {
3486         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputMargin(
3487             node->uiNodeHandle, &top, &right, &bottom, &left);
3488     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3489         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaMargin(
3490             node->uiNodeHandle, &top, &right, &bottom, &left);
3491     } else {
3492         fullImpl->getNodeModifiers()->getCommonModifier()->setMargin(node->uiNodeHandle, &top, &right, &bottom, &left);
3493     }
3494     return ERROR_CODE_NO_ERROR;
3495 }
3496 
ResetMarginPercent(ArkUI_NodeHandle node)3497 void ResetMarginPercent(ArkUI_NodeHandle node)
3498 {
3499     ResetMargin(node);
3500 }
3501 
GetMarginPercent(ArkUI_NodeHandle node)3502 const ArkUI_AttributeItem* GetMarginPercent(ArkUI_NodeHandle node)
3503 {
3504     auto* fullImpl = GetFullImpl();
3505     ArkUI_Float32 margins[NUM_4];
3506     ArkUI_Int32 length = 0;
3507     fullImpl->getNodeModifiers()->getCommonModifier()->getMargin(node->uiNodeHandle, &margins, length, UNIT_PERCENT);
3508     g_numberValues[NUM_0].f32 = margins[NUM_0];
3509     g_numberValues[NUM_1].f32 = margins[NUM_1];
3510     g_numberValues[NUM_3].f32 = margins[NUM_3];
3511     return &g_attributeItem;
3512 }
3513 
SetRenderFit(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3514 int32_t SetRenderFit(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3515 {
3516     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3517     if (actualSize < 0 ||
3518         item->value[NUM_0].i32 < ArkUI_RenderFit::ARKUI_RENDER_FIT_CENTER ||
3519         item->value[NUM_0].i32 > ArkUI_RenderFit::ARKUI_RENDER_FIT_RESIZE_COVER_BOTTOM_RIGHT) {
3520         return ERROR_CODE_PARAM_INVALID;
3521     }
3522     auto* fullImpl = GetFullImpl();
3523     if (node->type == ARKUI_NODE_XCOMPONENT) {
3524         fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentRenderFit(node->uiNodeHandle, item->value[NUM_0].i32);
3525     } else {
3526         fullImpl->getNodeModifiers()->getCommonModifier()->setRenderFit(node->uiNodeHandle, item->value[NUM_0].i32);
3527     }
3528     return ERROR_CODE_NO_ERROR;
3529 }
3530 
ResetRenderFit(ArkUI_NodeHandle node)3531 void ResetRenderFit(ArkUI_NodeHandle node)
3532 {
3533     auto* fullImpl = GetFullImpl();
3534     if (node->type == ARKUI_NODE_XCOMPONENT) {
3535         fullImpl->getNodeModifiers()->getXComponentModifier()->resetXComponentRenderFit(node->uiNodeHandle);
3536     } else {
3537         fullImpl->getNodeModifiers()->getCommonModifier()->resetRenderFit(node->uiNodeHandle);
3538     }
3539 }
3540 
GetRenderFit(ArkUI_NodeHandle node)3541 const ArkUI_AttributeItem* GetRenderFit(ArkUI_NodeHandle node)
3542 {
3543     auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3544     g_numberValues[0].i32 = modifier->getRenderFit(node->uiNodeHandle);
3545     return &g_attributeItem;
3546 }
3547 
SetOutlineColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3548 int32_t SetOutlineColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3549 {
3550     if (item->size == 0) {
3551         return ERROR_CODE_PARAM_INVALID;
3552     }
3553     // already check in entry point.
3554     auto* fullImpl = GetFullImpl();
3555     uint32_t colors[ALLOW_SIZE_8] = { DEFAULT_TRUE, DEFAULT_COLOR, DEFAULT_TRUE, DEFAULT_COLOR,
3556         DEFAULT_TRUE, DEFAULT_COLOR, DEFAULT_TRUE, DEFAULT_COLOR };
3557     if (item->size == 1) {
3558         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
3559             colors[NUM_2 * i + NUM_1] = item->value[0].u32;
3560         }
3561     } else if (item->size == ALLOW_SIZE_4) {
3562         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
3563             colors[NUM_2 * i + NUM_1] = item->value[i].u32;
3564         }
3565     } else {
3566         return ERROR_CODE_PARAM_INVALID;
3567     }
3568 
3569     fullImpl->getNodeModifiers()->getCommonModifier()->setOutlineColor(
3570         node->uiNodeHandle, colors, ALLOW_SIZE_8);
3571     return ERROR_CODE_NO_ERROR;
3572 }
3573 
ResetOutlineColor(ArkUI_NodeHandle node)3574 void ResetOutlineColor(ArkUI_NodeHandle node)
3575 {
3576     auto* fullImpl = GetFullImpl();
3577     fullImpl->getNodeModifiers()->getCommonModifier()->resetOutlineColor(node->uiNodeHandle);
3578 }
3579 
GetOutlineColor(ArkUI_NodeHandle node)3580 const ArkUI_AttributeItem* GetOutlineColor(ArkUI_NodeHandle node)
3581 {
3582     auto* fullImpl = GetFullImpl();
3583     ArkUI_Uint32 colors[NUM_4];
3584     fullImpl->getNodeModifiers()->getCommonModifier()->getOutlineColor(node->uiNodeHandle, &colors);
3585     g_numberValues[NUM_0].u32 = colors[NUM_0];
3586     g_numberValues[NUM_1].u32 = colors[NUM_1];
3587     g_numberValues[NUM_2].u32 = colors[NUM_2];
3588     g_numberValues[NUM_3].u32 = colors[NUM_3];
3589     return &g_attributeItem;
3590 }
3591 
SetSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3592 int32_t SetSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3593 {
3594     if (item->size <= NUM_0 || item->size > NUM_2) {
3595         return ERROR_CODE_PARAM_INVALID;
3596     }
3597     ArkUI_Float32 size[NUM_2] = { ZERO_F, ZERO_F };
3598     for (auto i = 0; i < item->size; ++i) {
3599         size[i] = item->value[i].f32;
3600     }
3601     ArkUI_Int32 unit[NUM_2];
3602     unit[NUM_0] = GetDefaultUnit(node, UNIT_VP);
3603     unit[NUM_1] = GetDefaultUnit(node, UNIT_VP);
3604     // already check in entry point.
3605     auto* fullImpl = GetFullImpl();
3606     // 1 for vp. check in DimensionUnit.
3607     fullImpl->getNodeModifiers()->getCommonModifier()->setSize(
3608         node->uiNodeHandle, size, unit, nullptr);
3609     return ERROR_CODE_NO_ERROR;
3610 }
3611 
ResetSize(ArkUI_NodeHandle node)3612 void ResetSize(ArkUI_NodeHandle node)
3613 {
3614     auto* fullImpl = GetFullImpl();
3615     fullImpl->getNodeModifiers()->getCommonModifier()->resetSize(node->uiNodeHandle);
3616 }
3617 
GetSize(ArkUI_NodeHandle node)3618 const ArkUI_AttributeItem* GetSize(ArkUI_NodeHandle node)
3619 {
3620     auto* fullImpl = GetFullImpl();
3621     ArkUI_Float32 size[NUM_2];
3622     fullImpl->getNodeModifiers()->getCommonModifier()->getSize(
3623         node->uiNodeHandle, &size, GetDefaultUnit(node, UNIT_VP));
3624     g_numberValues[NUM_0].f32 = size[NUM_0];
3625     g_numberValues[NUM_1].f32 = size[NUM_1];
3626     return &g_attributeItem;
3627 }
3628 
SetRenderGroup(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3629 int32_t SetRenderGroup(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3630 {
3631     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
3632         return ERROR_CODE_PARAM_INVALID;
3633     }
3634     auto* fullImpl = GetFullImpl();
3635     fullImpl->getNodeModifiers()->getCommonModifier()->setRenderGroup(
3636         node->uiNodeHandle, item->value[NUM_0].i32);
3637     return ERROR_CODE_NO_ERROR;
3638 }
3639 
ResetRenderGroup(ArkUI_NodeHandle node)3640 void ResetRenderGroup(ArkUI_NodeHandle node)
3641 {
3642     auto* fullImpl = GetFullImpl();
3643     fullImpl->getNodeModifiers()->getCommonModifier()->resetRenderGroup(node->uiNodeHandle);
3644 }
3645 
GetRenderGroup(ArkUI_NodeHandle node)3646 const ArkUI_AttributeItem* GetRenderGroup(ArkUI_NodeHandle node)
3647 {
3648     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getRenderGroup(node->uiNodeHandle);
3649     g_numberValues[0].i32 = resultValue;
3650     return &g_attributeItem;
3651 }
3652 
SetColorBlend(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3653 int32_t SetColorBlend(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3654 {
3655     if (item->size != NUM_1) {
3656         return ERROR_CODE_PARAM_INVALID;
3657     }
3658     auto* fullImpl = GetFullImpl();
3659     fullImpl->getNodeModifiers()->getCommonModifier()->setColorBlend(
3660         node->uiNodeHandle, item->value[NUM_0].u32);
3661     return ERROR_CODE_NO_ERROR;
3662 }
3663 
ResetColorBlend(ArkUI_NodeHandle node)3664 void ResetColorBlend(ArkUI_NodeHandle node)
3665 {
3666     auto* fullImpl = GetFullImpl();
3667     fullImpl->getNodeModifiers()->getCommonModifier()->resetColorBlend(node->uiNodeHandle);
3668 }
3669 
GetColorBlend(ArkUI_NodeHandle node)3670 const ArkUI_AttributeItem* GetColorBlend(ArkUI_NodeHandle node)
3671 {
3672     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getColorBlend(node->uiNodeHandle);
3673     g_numberValues[0].u32 = resultValue;
3674     return &g_attributeItem;
3675 }
3676 
SetExpandSafeArea(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3677 int32_t SetExpandSafeArea(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3678 {
3679     if (item->size == 0) {
3680         return ERROR_CODE_PARAM_INVALID;
3681     }
3682     ArkUI_Uint32 safeAreaType = NG::SAFE_AREA_TYPE_NONE;
3683     ArkUI_Uint32 safeAreaEdge = NG::SAFE_AREA_EDGE_NONE;
3684     if (item->size > 0 && item->value[0].u32 > 0) {
3685         if (item->value[0].u32 > NUM_7) {
3686             return ERROR_CODE_PARAM_INVALID;
3687         } else {
3688             safeAreaType = item->value[0].u32;
3689         }
3690     } else {
3691         safeAreaType = NG::SAFE_AREA_TYPE_ALL;
3692     }
3693     if (item->size > NUM_1 && item->value[1].u32 > 0) {
3694         if (item->value[1].u32 > NUM_15) {
3695             return ERROR_CODE_PARAM_INVALID;
3696         } else {
3697             safeAreaEdge = item->value[1].u32;
3698         }
3699     } else {
3700         safeAreaEdge = NG::SAFE_AREA_EDGE_ALL;
3701     }
3702     GetFullImpl()->getNodeModifiers()->getCommonModifier()->setExpandSafeArea(
3703         node->uiNodeHandle, safeAreaType, safeAreaEdge);
3704     return ERROR_CODE_NO_ERROR;
3705 }
3706 
ResetExpandSafeArea(ArkUI_NodeHandle node)3707 void ResetExpandSafeArea(ArkUI_NodeHandle node)
3708 {
3709     auto* fullImpl = GetFullImpl();
3710     fullImpl->getNodeModifiers()->getCommonModifier()->resetExpandSafeArea(node->uiNodeHandle);
3711 }
3712 
GetExpandSafeArea(ArkUI_NodeHandle node)3713 const ArkUI_AttributeItem* GetExpandSafeArea(ArkUI_NodeHandle node)
3714 {
3715     ArkUI_Uint32 values[NUM_2];
3716     GetFullImpl()->getNodeModifiers()->getCommonModifier()->getExpandSafeArea(node->uiNodeHandle, &values);
3717     g_numberValues[NUM_0].u32 = values[NUM_0];
3718     g_numberValues[NUM_1].u32 = values[NUM_1];
3719     return &g_attributeItem;
3720 }
3721 
SetTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3722 int32_t SetTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3723 {
3724     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
3725     auto fullImpl = GetFullImpl();
3726     node->transitionOption = item->object;
3727     auto effectOption = reinterpret_cast<ArkUI_TransitionEffect*>(item->object);
3728     auto toEffectOption = OHOS::Ace::TransitionModel::ConvertToEffectOption(effectOption);
3729     fullImpl->getNodeModifiers()->getCommonModifier()->setTransition(node->uiNodeHandle, toEffectOption);
3730     return ERROR_CODE_NO_ERROR;
3731 }
3732 
SetFocusBox(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3733 int32_t SetFocusBox(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3734 {
3735     if (item->size != NUM_3) {
3736         return ERROR_CODE_PARAM_INVALID;
3737     }
3738     auto* fullImpl = GetFullImpl();
3739     int32_t unit = GetDefaultUnit(node, UNIT_FP);
3740     fullImpl->getNodeModifiers()->getCommonModifier()->setFocusBoxStyle(
3741         node->uiNodeHandle, item->value[0].f32, unit, item->value[1].f32, unit, item->value[2].u32, NUM_7);
3742     return ERROR_CODE_NO_ERROR;
3743 }
3744 
ResetFocusBox(ArkUI_NodeHandle node)3745 void ResetFocusBox(ArkUI_NodeHandle node)
3746 {
3747     auto* fullImpl = GetFullImpl();
3748     fullImpl->getNodeModifiers()->getCommonModifier()->resetFocusBoxStyle(node->uiNodeHandle);
3749 }
3750 
SetTabStop(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3751 int32_t SetTabStop(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3752 {
3753     auto* fullImpl = GetFullImpl();
3754     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
3755         fullImpl->getNodeModifiers()->getCommonModifier()->setTabStop(node->uiNodeHandle, false);
3756         return ERROR_CODE_PARAM_INVALID;
3757     }
3758     fullImpl->getNodeModifiers()->getCommonModifier()->setTabStop(node->uiNodeHandle, item->value[0].i32);
3759     return ERROR_CODE_NO_ERROR;
3760 }
3761 
ResetTabStop(ArkUI_NodeHandle node)3762 void ResetTabStop(ArkUI_NodeHandle node)
3763 {
3764     auto* fullImpl = GetFullImpl();
3765     fullImpl->getNodeModifiers()->getCommonModifier()->resetTabStop(node->uiNodeHandle);
3766 }
3767 
GetTabStop(ArkUI_NodeHandle node)3768 const ArkUI_AttributeItem* GetTabStop(ArkUI_NodeHandle node)
3769 {
3770     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getTabStop(node->uiNodeHandle);
3771     g_numberValues[0].i32 = resultValue;
3772     return &g_attributeItem;
3773 }
3774 
GetTransition(ArkUI_NodeHandle node)3775 const ArkUI_AttributeItem* GetTransition(ArkUI_NodeHandle node)
3776 {
3777     g_attributeItem.object = node->transitionOption;
3778     return &g_attributeItem;
3779 }
3780 
GetUniqueID(ArkUI_NodeHandle node)3781 const ArkUI_AttributeItem* GetUniqueID(ArkUI_NodeHandle node)
3782 {
3783     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getNodeUniqueId(node->uiNodeHandle);
3784     g_numberValues[0].i32 = resultValue;
3785     return &g_attributeItem;
3786 }
3787 
3788 // Text
SetFontColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3789 int32_t SetFontColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3790 {
3791     if (item->size == NUM_0) {
3792         return ERROR_CODE_PARAM_INVALID;
3793     }
3794     // already check in entry point.
3795     auto* fullImpl = GetFullImpl();
3796     switch (node->type) {
3797         case ARKUI_NODE_TEXT_INPUT:
3798             fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontColor(
3799                 node->uiNodeHandle, item->value[0].u32);
3800             break;
3801         case ARKUI_NODE_TEXT:
3802             fullImpl->getNodeModifiers()->getTextModifier()->setFontColor(node->uiNodeHandle, item->value[0].u32);
3803             break;
3804         case ARKUI_NODE_SPAN:
3805             fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontColor(node->uiNodeHandle, item->value[0].u32);
3806             break;
3807         case ARKUI_NODE_BUTTON:
3808             fullImpl->getNodeModifiers()->getButtonModifier()->setButtonFontColor(
3809                 node->uiNodeHandle, item->value[0].u32);
3810             break;
3811         case ARKUI_NODE_TEXT_AREA:
3812             fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontColor(
3813                 node->uiNodeHandle, item->value[0].u32);
3814             break;
3815         default:
3816             return ERROR_CODE_PARAM_INVALID;
3817     }
3818     return ERROR_CODE_NO_ERROR;
3819 }
3820 
ResetFontColor(ArkUI_NodeHandle node)3821 void ResetFontColor(ArkUI_NodeHandle node)
3822 {
3823     auto* fullImpl = GetFullImpl();
3824     if (node->type == ARKUI_NODE_TEXT) {
3825         fullImpl->getNodeModifiers()->getTextModifier()->resetFontColor(node->uiNodeHandle);
3826     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
3827         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontColor(node->uiNodeHandle);
3828     } else if (node->type == ARKUI_NODE_SPAN) {
3829         fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanFontColor(node->uiNodeHandle);
3830     } else if (node->type == ARKUI_NODE_BUTTON) {
3831         fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonFontColor(node->uiNodeHandle);
3832     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3833         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontColor(node->uiNodeHandle);
3834     }
3835 }
3836 
SetFontWeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3837 int32_t SetFontWeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3838 {
3839     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3840     if (actualSize < 0 || item->value[NUM_0].i32 < 0 ||
3841         item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_FONT_WEIGHT_REGULAR)) {
3842         return ERROR_CODE_PARAM_INVALID;
3843     }
3844     // already check in entry point.
3845     auto* fullImpl = GetFullImpl();
3846     switch (node->type) {
3847         case ARKUI_NODE_TEXT_INPUT:
3848             fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontWeight(
3849                 node->uiNodeHandle, item->value[0].i32);
3850             break;
3851         case ARKUI_NODE_TEXT:
3852             fullImpl->getNodeModifiers()->getTextModifier()->setFontWeight(node->uiNodeHandle, item->value[0].i32);
3853             break;
3854         case ARKUI_NODE_SPAN:
3855             fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontWeight(node->uiNodeHandle, item->value[0].i32);
3856             break;
3857         case ARKUI_NODE_BUTTON:
3858             fullImpl->getNodeModifiers()->getButtonModifier()->setButtonFontWeightEnum(
3859                 node->uiNodeHandle, item->value[0].i32);
3860             break;
3861         case ARKUI_NODE_TEXT_AREA:
3862             fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontWeight(
3863                 node->uiNodeHandle, item->value[0].i32);
3864             break;
3865         default:
3866             return ERROR_CODE_PARAM_INVALID;
3867     }
3868     return ERROR_CODE_NO_ERROR;
3869 }
3870 
ResetFontWeight(ArkUI_NodeHandle node)3871 void ResetFontWeight(ArkUI_NodeHandle node)
3872 {
3873     auto* fullImpl = GetFullImpl();
3874     if (node->type == ARKUI_NODE_TEXT) {
3875         fullImpl->getNodeModifiers()->getTextModifier()->resetFontWeight(node->uiNodeHandle);
3876     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
3877         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontWeight(node->uiNodeHandle);
3878     } else if (node->type == ARKUI_NODE_SPAN) {
3879         fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanFontWeight(node->uiNodeHandle);
3880     } else if (node->type == ARKUI_NODE_BUTTON) {
3881         fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonFontWeight(node->uiNodeHandle);
3882     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3883         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontWeight(node->uiNodeHandle);
3884     }
3885 }
3886 
SetFontSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3887 int32_t SetFontSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3888 {
3889     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3890     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
3891         return ERROR_CODE_PARAM_INVALID;
3892     }
3893     auto* fullImpl = GetFullImpl();
3894     int32_t unit = GetDefaultUnit(node, UNIT_FP);
3895     if (node->type == ARKUI_NODE_TEXT_INPUT) {
3896         struct ArkUILengthType fontSize = { nullptr, item->value[0].f32, unit };
3897         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontSize(node->uiNodeHandle, &fontSize);
3898     } else if (node->type == ARKUI_NODE_TEXT) {
3899         fullImpl->getNodeModifiers()->getTextModifier()->setFontSize(node->uiNodeHandle, item->value[0].f32, unit);
3900     } else if (node->type == ARKUI_NODE_SPAN) {
3901         fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontSize(
3902             node->uiNodeHandle, item->value[0].f32, unit);
3903     } else if (node->type == ARKUI_NODE_BUTTON) {
3904         fullImpl->getNodeModifiers()->getButtonModifier()->setButtonFontSize(node->uiNodeHandle,
3905             item->value[0].f32, unit);
3906     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3907         struct ArkUIResourceLength fontSize = { item->value[0].f32, unit, nullptr };
3908         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontSize(node->uiNodeHandle, &fontSize);
3909     } else {
3910         return ERROR_CODE_PARAM_INVALID;
3911     }
3912     return ERROR_CODE_NO_ERROR;
3913 }
3914 
ResetFontSize(ArkUI_NodeHandle node)3915 void ResetFontSize(ArkUI_NodeHandle node)
3916 {
3917     auto* fullImpl = GetFullImpl();
3918     if (node->type == ARKUI_NODE_TEXT) {
3919         fullImpl->getNodeModifiers()->getTextModifier()->resetFontSize(node->uiNodeHandle);
3920     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
3921         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontSize(node->uiNodeHandle);
3922     } else if (node->type == ARKUI_NODE_SPAN) {
3923         fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanFontSize(node->uiNodeHandle);
3924     } else if (node->type == ARKUI_NODE_BUTTON) {
3925         fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonFontSize(node->uiNodeHandle);
3926     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3927         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontSize(node->uiNodeHandle);
3928     }
3929 }
3930 
SetFontStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3931 int32_t SetFontStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3932 {
3933     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3934     if (actualSize < 0 || item->value[NUM_0].i32 < 0 ||
3935         item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_FONT_STYLE_ITALIC)) {
3936         return ERROR_CODE_PARAM_INVALID;
3937     }
3938     // already check in entry point.
3939     auto* fullImpl = GetFullImpl();
3940     switch (node->type) {
3941         case ARKUI_NODE_TEXT_INPUT:
3942             fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontStyle(
3943                 node->uiNodeHandle, item->value[0].i32);
3944             break;
3945         case ARKUI_NODE_TEXT:
3946             fullImpl->getNodeModifiers()->getTextModifier()->setFontStyle(node->uiNodeHandle, item->value[0].i32);
3947             break;
3948         case ARKUI_NODE_SPAN:
3949             fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontStyle(node->uiNodeHandle, item->value[0].i32);
3950             break;
3951         case ARKUI_NODE_TEXT_AREA:
3952             fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontStyle(
3953                 node->uiNodeHandle, item->value[0].i32);
3954             break;
3955         default:
3956             return ERROR_CODE_PARAM_INVALID;
3957     }
3958     return ERROR_CODE_NO_ERROR;
3959 }
3960 
ResetFontStyle(ArkUI_NodeHandle node)3961 void ResetFontStyle(ArkUI_NodeHandle node)
3962 {
3963     auto* fullImpl = GetFullImpl();
3964     if (node->type == ARKUI_NODE_TEXT) {
3965         fullImpl->getNodeModifiers()->getTextModifier()->resetFontStyle(node->uiNodeHandle);
3966     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
3967         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontStyle(node->uiNodeHandle);
3968     } else if (node->type == ARKUI_NODE_SPAN) {
3969         fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanFontStyle(node->uiNodeHandle);
3970     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3971         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontStyle(node->uiNodeHandle);
3972     }
3973 }
3974 
SetTextInputPlaceholder(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3975 int32_t SetTextInputPlaceholder(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3976 {
3977     // already check in entry point.
3978     auto* fullImpl = GetFullImpl();
3979     ArkUI_CharPtr itemString = item->string;
3980     if (!itemString) {
3981         itemString = "";
3982     }
3983     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPlaceholderString(
3984         node->uiNodeHandle, itemString);
3985     return ERROR_CODE_NO_ERROR;
3986 }
3987 
GetTextInputPlaceholder(ArkUI_NodeHandle node)3988 const ArkUI_AttributeItem* GetTextInputPlaceholder(ArkUI_NodeHandle node)
3989 {
3990     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputPlaceholder(
3991         node->uiNodeHandle);
3992     g_attributeItem.string = resultValue;
3993     return &g_attributeItem;
3994 }
3995 
ResetTextInputPlaceholder(ArkUI_NodeHandle node)3996 void ResetTextInputPlaceholder(ArkUI_NodeHandle node)
3997 {
3998     auto* fullImpl = GetFullImpl();
3999     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPlaceholderString(node->uiNodeHandle, "");
4000 }
4001 
SetTextInputText(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4002 int32_t SetTextInputText(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4003 {
4004     // already check in entry point.
4005     auto* fullImpl = GetFullImpl();
4006     ArkUI_CharPtr itemString = item->string;
4007     if (!itemString) {
4008         itemString = "";
4009     }
4010     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextString(
4011         node->uiNodeHandle, itemString);
4012     return ERROR_CODE_NO_ERROR;
4013 }
4014 
GetTextInputText(ArkUI_NodeHandle node)4015 const ArkUI_AttributeItem* GetTextInputText(ArkUI_NodeHandle node)
4016 {
4017     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputText(
4018         node->uiNodeHandle);
4019     g_attributeItem.string = resultValue;
4020     return &g_attributeItem;
4021 }
4022 
ResetTextInputText(ArkUI_NodeHandle node)4023 void ResetTextInputText(ArkUI_NodeHandle node)
4024 {
4025     auto* fullImpl = GetFullImpl();
4026     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextString(node->uiNodeHandle, "");
4027 }
4028 
SetCaretColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4029 int32_t SetCaretColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4030 {
4031     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4032     if (actualSize < 0) {
4033         return ERROR_CODE_PARAM_INVALID;
4034     }
4035     // already check in entry point.
4036     auto* fullImpl = GetFullImpl();
4037     if (node->type == ARKUI_NODE_TEXT_INPUT) {
4038         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCaretColor(
4039             node->uiNodeHandle, item->value[NUM_0].u32);
4040     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4041         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaCaretColor(
4042             node->uiNodeHandle, item->value[NUM_0].u32);
4043     } else {
4044         return ERROR_CODE_PARAM_INVALID;
4045     }
4046     return ERROR_CODE_NO_ERROR;
4047 }
4048 
GetCaretColor(ArkUI_NodeHandle node)4049 const ArkUI_AttributeItem* GetCaretColor(ArkUI_NodeHandle node)
4050 {
4051     uint32_t resultValue = DEFAULT_COLOR;
4052     if (node->type == ARKUI_NODE_TEXT_INPUT) {
4053         resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputCaretColor(
4054             node->uiNodeHandle);
4055     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4056         resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaCaretColor(
4057             node->uiNodeHandle);
4058     }
4059     g_numberValues[0].u32 = resultValue;
4060     return &g_attributeItem;
4061 }
4062 
ResetCaretColor(ArkUI_NodeHandle node)4063 void ResetCaretColor(ArkUI_NodeHandle node)
4064 {
4065     auto* fullImpl = GetFullImpl();
4066     switch (node->type) {
4067         case ARKUI_NODE_TEXT_INPUT:
4068             fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCaretColor(node->uiNodeHandle);
4069             break;
4070         case ARKUI_NODE_TEXT_AREA:
4071             fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaCaretColor(node->uiNodeHandle);
4072             break;
4073         default:
4074             break;
4075     }
4076 }
4077 
SetCaretStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4078 int32_t SetCaretStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4079 {
4080     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4081     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
4082         return ERROR_CODE_PARAM_INVALID;
4083     }
4084     // already check in entry point.
4085     auto* fullImpl = GetFullImpl();
4086     int32_t unit = GetDefaultUnit(node, UNIT_VP);
4087     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCaret(
4088         node->uiNodeHandle, item->value[NUM_0].f32, unit);
4089     return ERROR_CODE_NO_ERROR;
4090 }
4091 
GetCaretStyle(ArkUI_NodeHandle node)4092 const ArkUI_AttributeItem* GetCaretStyle(ArkUI_NodeHandle node)
4093 {
4094     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
4095     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputCaretStyle(
4096         node->uiNodeHandle, unit);
4097     g_numberValues[0].f32 = resultValue;
4098     return &g_attributeItem;
4099 }
4100 
ResetCaretStyle(ArkUI_NodeHandle node)4101 void ResetCaretStyle(ArkUI_NodeHandle node)
4102 {
4103     auto* fullImpl = GetFullImpl();
4104     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCaretStyle(node->uiNodeHandle);
4105 }
4106 
SetShowUnderline(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4107 int32_t SetShowUnderline(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4108 {
4109     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4110     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
4111         return ERROR_CODE_PARAM_INVALID;
4112     }
4113     auto* fullImpl = GetFullImpl();
4114     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputShowUnderline(
4115         node->uiNodeHandle, item->value[NUM_0].i32);
4116     return ERROR_CODE_NO_ERROR;
4117 }
4118 
GetShowUnderline(ArkUI_NodeHandle node)4119 const ArkUI_AttributeItem* GetShowUnderline(ArkUI_NodeHandle node)
4120 {
4121     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputShowUnderline(
4122         node->uiNodeHandle);
4123     g_numberValues[0].i32 = resultValue;
4124     return &g_attributeItem;
4125 }
4126 
ResetShowUnderline(ArkUI_NodeHandle node)4127 void ResetShowUnderline(ArkUI_NodeHandle node)
4128 {
4129     auto* fullImpl = GetFullImpl();
4130     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputShowUnderline(node->uiNodeHandle);
4131 }
4132 
SetMaxLength(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4133 int32_t SetMaxLength(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4134 {
4135     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4136     if (actualSize < 0 || item->value[NUM_0].i32 < 0) {
4137         return ERROR_CODE_PARAM_INVALID;
4138     }
4139     // already check in entry point.
4140     auto* fullImpl = GetFullImpl();
4141     if (node->type == ARKUI_NODE_TEXT_INPUT) {
4142         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputMaxLength(
4143             node->uiNodeHandle, item->value[NUM_0].i32);
4144     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4145         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaMaxLength(
4146             node->uiNodeHandle, item->value[NUM_0].i32);
4147     } else {
4148         return ERROR_CODE_PARAM_INVALID;
4149     }
4150     return ERROR_CODE_NO_ERROR;
4151 }
4152 
GetMaxLength(ArkUI_NodeHandle node)4153 const ArkUI_AttributeItem* GetMaxLength(ArkUI_NodeHandle node)
4154 {
4155     float resultValue = NUM_0;
4156     if (node->type == ARKUI_NODE_TEXT_INPUT) {
4157         resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputMaxLength(
4158             node->uiNodeHandle);
4159     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4160         resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaMaxLength(
4161             node->uiNodeHandle);
4162     }
4163     g_numberValues[0].i32 = resultValue;
4164     return &g_attributeItem;
4165 }
4166 
ResetMaxLength(ArkUI_NodeHandle node)4167 void ResetMaxLength(ArkUI_NodeHandle node)
4168 {
4169     auto* fullImpl = GetFullImpl();
4170     switch (node->type) {
4171         case ARKUI_NODE_TEXT_INPUT:
4172             fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputMaxLength(node->uiNodeHandle);
4173             break;
4174         case ARKUI_NODE_TEXT_AREA:
4175             fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaMaxLength(node->uiNodeHandle);
4176             break;
4177         default:
4178             break;
4179     }
4180 }
4181 
SetEnterKeyType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4182 int32_t SetEnterKeyType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4183 {
4184     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4185     if (actualSize < 0 || item->value[NUM_0].i32 < static_cast<int32_t>(ARKUI_ENTER_KEY_TYPE_GO) ||
4186         item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_ENTER_KEY_TYPE_NEW_LINE)) {
4187         return ERROR_CODE_PARAM_INVALID;
4188     }
4189     // already check in entry point.
4190     auto* fullImpl = GetFullImpl();
4191     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputEnterKeyType(
4192         node->uiNodeHandle, item->value[NUM_0].i32);
4193     return ERROR_CODE_NO_ERROR;
4194 }
4195 
GetEnterKeyType(ArkUI_NodeHandle node)4196 const ArkUI_AttributeItem* GetEnterKeyType(ArkUI_NodeHandle node)
4197 {
4198     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputEnterKeyType(
4199         node->uiNodeHandle);
4200     g_numberValues[0].i32 = resultValue;
4201     return &g_attributeItem;
4202 }
4203 
ResetEnterKeyType(ArkUI_NodeHandle node)4204 void ResetEnterKeyType(ArkUI_NodeHandle node)
4205 {
4206     auto* fullImpl = GetFullImpl();
4207     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputEnterKeyType(node->uiNodeHandle);
4208 }
4209 
SetPlaceholderColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4210 int32_t SetPlaceholderColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4211 {
4212     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4213     if (actualSize < 0) {
4214         return ERROR_CODE_PARAM_INVALID;
4215     }
4216     // already check in entry point.
4217     auto* fullImpl = GetFullImpl();
4218     if (node->type == ARKUI_NODE_TEXT_INPUT) {
4219         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPlaceholderColor(
4220             node->uiNodeHandle, item->value[NUM_0].u32);
4221     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4222         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPlaceholderColor(
4223             node->uiNodeHandle, item->value[NUM_0].u32);
4224     } else {
4225         return ERROR_CODE_PARAM_INVALID;
4226     }
4227     return ERROR_CODE_NO_ERROR;
4228 }
4229 
GetPlaceholderColor(ArkUI_NodeHandle node)4230 const ArkUI_AttributeItem* GetPlaceholderColor(ArkUI_NodeHandle node)
4231 {
4232     uint32_t resultValue = DEFAULT_COLOR;
4233     if (node->type == ARKUI_NODE_TEXT_INPUT) {
4234         resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputPlaceholderColor(
4235             node->uiNodeHandle);
4236     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4237         resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaPlaceholderColor(
4238             node->uiNodeHandle);
4239     }
4240     g_numberValues[0].u32 = resultValue;
4241     return &g_attributeItem;
4242 }
4243 
ResetPlaceholderColor(ArkUI_NodeHandle node)4244 void ResetPlaceholderColor(ArkUI_NodeHandle node)
4245 {
4246     auto* fullImpl = GetFullImpl();
4247     switch (node->type) {
4248         case ARKUI_NODE_TEXT_INPUT:
4249             fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputPlaceholderColor(node->uiNodeHandle);
4250             break;
4251         case ARKUI_NODE_TEXT_AREA:
4252             fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaPlaceholderColor(node->uiNodeHandle);
4253             break;
4254         default:
4255             break;
4256     }
4257 }
4258 
SetTextInputPlaceholderFont(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4259 int32_t SetTextInputPlaceholderFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4260 {
4261     if (item == nullptr) {
4262         return ERROR_CODE_PARAM_INVALID;
4263     }
4264     auto* fullImpl = GetFullImpl();
4265     struct ArkUIResourceLength size = { 16.0, GetDefaultUnit(node, UNIT_FP) };
4266     int weight = ARKUI_FONT_WEIGHT_NORMAL;
4267     int style = ARKUI_FONT_STYLE_NORMAL;
4268     if (item->size > NUM_0) {
4269         if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
4270             return ERROR_CODE_PARAM_INVALID;
4271         }
4272         size.value = item->value[NUM_0].f32;
4273     }
4274     if (item->size > NUM_1) {
4275         if (item->value[NUM_1].i32 < 0 || item->value[NUM_1].i32 > static_cast<int32_t>(ARKUI_FONT_STYLE_ITALIC)) {
4276             return ERROR_CODE_PARAM_INVALID;
4277         }
4278         style = item->value[NUM_1].i32;
4279     }
4280     if (item->size > NUM_2) {
4281         if (item->value[NUM_2].i32 < 0 || item->value[NUM_2].i32 > static_cast<int32_t>(ARKUI_FONT_WEIGHT_REGULAR)) {
4282             return ERROR_CODE_PARAM_INVALID;
4283         }
4284         weight = item->value[NUM_2].i32;
4285     }
4286     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPlaceholderFontEnum(
4287         node->uiNodeHandle, &size, weight, item->string, style);
4288     return ERROR_CODE_NO_ERROR;
4289 }
4290 
GetTextInputPlaceholderFont(ArkUI_NodeHandle node)4291 const ArkUI_AttributeItem* GetTextInputPlaceholderFont(ArkUI_NodeHandle node)
4292 {
4293     ArkUITextFont font;
4294     font.fontSizeUnit = GetDefaultUnit(node, UNIT_FP);
4295     GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputPlaceholderFont(
4296         node->uiNodeHandle, &font);
4297     int index = 0;
4298     g_numberValues[index++].f32 = font.fontSize;
4299     g_numberValues[index++].i32 = font.fontStyle;
4300     g_numberValues[index++].i32 = font.fontWeight;
4301     g_attributeItem.size = index;
4302     g_attributeItem.string = font.fontFamilies;
4303     return &g_attributeItem;
4304 }
4305 
ResetTextInputPlaceholderFont(ArkUI_NodeHandle node)4306 void ResetTextInputPlaceholderFont(ArkUI_NodeHandle node)
4307 {
4308     auto* fullImpl = GetFullImpl();
4309     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputPlaceholderFont(node->uiNodeHandle);
4310 }
4311 
SetEnableKeyboardOnFocus(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4312 int32_t SetEnableKeyboardOnFocus(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4313 {
4314     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4315     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
4316         return ERROR_CODE_PARAM_INVALID;
4317     }
4318     // already check in entry point.
4319     auto* fullImpl = GetFullImpl();
4320     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputEnableKeyboardOnFocus(
4321         node->uiNodeHandle, item->value[NUM_0].i32);
4322     return ERROR_CODE_NO_ERROR;
4323 }
4324 
GetEnableKeyboardOnFocus(ArkUI_NodeHandle node)4325 const ArkUI_AttributeItem* GetEnableKeyboardOnFocus(ArkUI_NodeHandle node)
4326 {
4327     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputRequestKeyboardOnFocus(
4328         node->uiNodeHandle);
4329     g_numberValues[0].i32 = resultValue;
4330     return &g_attributeItem;
4331 }
4332 
ResetEnableKeyboardOnFocus(ArkUI_NodeHandle node)4333 void ResetEnableKeyboardOnFocus(ArkUI_NodeHandle node)
4334 {
4335     auto* fullImpl = GetFullImpl();
4336     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputEnableKeyboardOnFocus(node->uiNodeHandle);
4337 }
4338 
SetTextInputType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4339 int32_t SetTextInputType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4340 {
4341     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4342     if (actualSize < 0 || item->value[NUM_0].i32 < static_cast<int32_t>(ARKUI_TEXTINPUT_TYPE_NORMAL) ||
4343         item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_TEXTINPUT_TYPE_NUMBER_DECIMAL)) {
4344         return ERROR_CODE_PARAM_INVALID;
4345     }
4346     // already check in entry point.
4347     auto* fullImpl = GetFullImpl();
4348     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputType(
4349         node->uiNodeHandle, item->value[NUM_0].i32);
4350     return ERROR_CODE_NO_ERROR;
4351 }
4352 
GetTextInputType(ArkUI_NodeHandle node)4353 const ArkUI_AttributeItem* GetTextInputType(ArkUI_NodeHandle node)
4354 {
4355     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputType(
4356         node->uiNodeHandle);
4357     g_numberValues[0].i32 = resultValue;
4358     return &g_attributeItem;
4359 }
4360 
ResetTextInputType(ArkUI_NodeHandle node)4361 void ResetTextInputType(ArkUI_NodeHandle node)
4362 {
4363     auto* fullImpl = GetFullImpl();
4364     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputType(node->uiNodeHandle);
4365 }
4366 
SetSelectedBackgroundColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4367 int32_t SetSelectedBackgroundColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4368 {
4369     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4370     if (actualSize < 0) {
4371         return ERROR_CODE_PARAM_INVALID;
4372     }
4373     // already check in entry point.
4374     auto* fullImpl = GetFullImpl();
4375     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputSelectedBackgroundColor(
4376         node->uiNodeHandle, item->value[0].u32);
4377     return ERROR_CODE_NO_ERROR;
4378 }
4379 
GetSelectedBackgroundColor(ArkUI_NodeHandle node)4380 const ArkUI_AttributeItem* GetSelectedBackgroundColor(ArkUI_NodeHandle node)
4381 {
4382     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputSelectedBackgroundColor(
4383         node->uiNodeHandle);
4384     g_numberValues[0].u32 = resultValue;
4385     return &g_attributeItem;
4386 }
4387 
ResetSelectedBackgroundColor(ArkUI_NodeHandle node)4388 void ResetSelectedBackgroundColor(ArkUI_NodeHandle node)
4389 {
4390     auto* fullImpl = GetFullImpl();
4391     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputSelectedBackgroundColor(node->uiNodeHandle);
4392 }
4393 
SetShowPasswordIcon(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4394 int32_t SetShowPasswordIcon(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4395 {
4396     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4397     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
4398         return ERROR_CODE_PARAM_INVALID;
4399     }
4400     // already check in entry point.
4401     auto* fullImpl = GetFullImpl();
4402     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputShowPasswordIcon(
4403         node->uiNodeHandle, item->value[NUM_0].i32);
4404     return ERROR_CODE_NO_ERROR;
4405 }
4406 
GetShowPasswordIcon(ArkUI_NodeHandle node)4407 const ArkUI_AttributeItem* GetShowPasswordIcon(ArkUI_NodeHandle node)
4408 {
4409     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputShowPasswordIcon(
4410         node->uiNodeHandle);
4411     g_numberValues[0].i32 = resultValue;
4412     return &g_attributeItem;
4413 }
4414 
ResetShowPasswordIcon(ArkUI_NodeHandle node)4415 void ResetShowPasswordIcon(ArkUI_NodeHandle node)
4416 {
4417     auto* fullImpl = GetFullImpl();
4418     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputShowPasswordIcon(node->uiNodeHandle);
4419 }
4420 
StopTextInputEditing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4421 int32_t StopTextInputEditing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4422 {
4423     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4424     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
4425         return ERROR_CODE_PARAM_INVALID;
4426     }
4427     // already check in entry point.
4428     auto* fullImpl = GetFullImpl();
4429     if (item->value[NUM_0].i32 == 0) {
4430         fullImpl->getNodeModifiers()->getTextInputModifier()->stopTextInputTextEditing(node->uiNodeHandle);
4431     }
4432     return ERROR_CODE_NO_ERROR;
4433 }
4434 
GetTextInputEditing(ArkUI_NodeHandle node)4435 const ArkUI_AttributeItem* GetTextInputEditing(ArkUI_NodeHandle node)
4436 {
4437     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputEditing(
4438         node->uiNodeHandle);
4439     g_numberValues[0].i32 = resultValue;
4440     return &g_attributeItem;
4441 }
4442 
SetTextInputCancelButton(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4443 int32_t SetTextInputCancelButton(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4444 {
4445     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4446     if (actualSize < 0 || !InRegion(static_cast<int32_t>(ARKUI_CANCELBUTTON_STYLE_CONSTANT),
4447         static_cast<int32_t>(ARKUI_CANCELBUTTON_STYLE_INPUT), item->value[NUM_0].i32)) {
4448         return ERROR_CODE_PARAM_INVALID;
4449     }
4450     struct ArkUISizeType size = { -1.0f, GetDefaultUnit(node, UNIT_VP) };
4451     if (item->size > NUM_1) {
4452         size.value = item->value[NUM_1].f32;
4453     }
4454     uint32_t color = DEFAULT_COLOR;
4455     if (item->size > NUM_2) {
4456         color = item->value[NUM_2].u32;
4457     }
4458     std::string str = "";
4459     if (item->string) {
4460         str.assign(item->string);
4461     }
4462     auto* fullImpl = GetFullImpl();
4463     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCancelButton(node->uiNodeHandle,
4464         item->value[NUM_0].i32, &size, color, str.c_str());
4465     return ERROR_CODE_NO_ERROR;
4466 }
4467 
GetTextInputCancelButton(ArkUI_NodeHandle node)4468 const ArkUI_AttributeItem* GetTextInputCancelButton(ArkUI_NodeHandle node)
4469 {
4470     int index = 0;
4471     g_numberValues[index++].i32 =
4472         GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputCancelButtonStyle(node->uiNodeHandle);
4473     g_numberValues[index++].f32 =
4474         GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputCancelIconSize(
4475             node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
4476     g_numberValues[index++].u32 =
4477         GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputTextCancelIconColor(node->uiNodeHandle);
4478     g_attributeItem.size = index;
4479     g_attributeItem.string =
4480         GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputTextCancelIconSrc(node->uiNodeHandle);
4481     return &g_attributeItem;
4482 }
4483 
ResetTextInputCancelButton(ArkUI_NodeHandle node)4484 void ResetTextInputCancelButton(ArkUI_NodeHandle node)
4485 {
4486     auto* fullImpl = GetFullImpl();
4487     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCancelButton(node->uiNodeHandle);
4488 }
4489 
SetTextInputTextSelection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4490 int32_t SetTextInputTextSelection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4491 {
4492     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
4493     if (actualSize < 0) {
4494         return ERROR_CODE_PARAM_INVALID;
4495     }
4496     if (item->value[NUM_0].i32 > item->value[NUM_1].i32) {
4497         return ERROR_CODE_PARAM_INVALID;
4498     }
4499     // already check in entry point.
4500     auto* fullImpl = GetFullImpl();
4501     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextSelection(
4502         node->uiNodeHandle, item->value[NUM_0].i32, item->value[NUM_1].i32);
4503     return ERROR_CODE_NO_ERROR;
4504 }
4505 
GetTextInputTextSelection(ArkUI_NodeHandle node)4506 const ArkUI_AttributeItem* GetTextInputTextSelection(ArkUI_NodeHandle node)
4507 {
4508     g_numberValues[0].i32 = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputTextSelectionIndex(
4509         node->uiNodeHandle, false);
4510     g_numberValues[1].i32 = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputTextSelectionIndex(
4511         node->uiNodeHandle, true);
4512     g_attributeItem.size = REQUIRED_TWO_PARAM;
4513     return &g_attributeItem;
4514 }
4515 
ResetTextInputTextSelection(ArkUI_NodeHandle node)4516 void ResetTextInputTextSelection(ArkUI_NodeHandle node)
4517 {
4518     auto* fullImpl = GetFullImpl();
4519     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextSelection(node->uiNodeHandle, NUM_0, NUM_0);
4520 }
4521 
SetTextInputSelectionMenuHidden(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4522 int32_t SetTextInputSelectionMenuHidden(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4523 {
4524     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
4525         return ERROR_CODE_PARAM_INVALID;
4526     }
4527     auto* fullImpl = GetFullImpl();
4528     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputSelectionMenuHidden(
4529         node->uiNodeHandle, item->value[NUM_0].i32);
4530     return ERROR_CODE_NO_ERROR;
4531 }
4532 
GetTextInputSelectionMenuHidden(ArkUI_NodeHandle node)4533 const ArkUI_AttributeItem* GetTextInputSelectionMenuHidden(ArkUI_NodeHandle node)
4534 {
4535     g_numberValues[0].i32 =
4536         GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputSelectionMenuHidden(node->uiNodeHandle);
4537     return &g_attributeItem;
4538 }
4539 
ResetTextInputSelectionMenuHidden(ArkUI_NodeHandle node)4540 void ResetTextInputSelectionMenuHidden(ArkUI_NodeHandle node)
4541 {
4542     auto* fullImpl = GetFullImpl();
4543     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputSelectionMenuHidden(node->uiNodeHandle);
4544 }
4545 
SetTextInputUnderlineColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4546 int32_t SetTextInputUnderlineColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4547 {
4548     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
4549     if (actualSize < 0) {
4550         return ERROR_CODE_PARAM_INVALID;
4551     }
4552     ArkUI_Uint32 values[NUM_4];
4553     values[NUM_0] = item->value[NUM_0].u32;
4554     values[NUM_1] = item->value[NUM_1].u32;
4555     values[NUM_2] = item->value[NUM_2].u32;
4556     values[NUM_3] = item->value[NUM_3].u32;
4557     ArkUI_Bool hasValues[NUM_4] = { 1, 1, 1, 1 };
4558     auto* fullImpl = GetFullImpl();
4559     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputUserUnderlineColor(
4560         node->uiNodeHandle, values, hasValues, NUM_4);
4561     return ERROR_CODE_NO_ERROR;
4562 }
4563 
GetTextInputUnderlineColor(ArkUI_NodeHandle node)4564 const ArkUI_AttributeItem* GetTextInputUnderlineColor(ArkUI_NodeHandle node)
4565 {
4566     ArkUI_Uint32 values[NUM_4];
4567     auto* fullImpl = GetFullImpl();
4568     fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputUserUnderlineColor(node->uiNodeHandle, &values);
4569     g_numberValues[NUM_0].u32 = values[NUM_0];
4570     g_numberValues[NUM_1].u32 = values[NUM_1];
4571     g_numberValues[NUM_2].u32 = values[NUM_2];
4572     g_numberValues[NUM_3].u32 = values[NUM_3];
4573     g_attributeItem.size = NUM_4;
4574     return &g_attributeItem;
4575 }
4576 
ResetTextInputUnderlineColor(ArkUI_NodeHandle node)4577 void ResetTextInputUnderlineColor(ArkUI_NodeHandle node)
4578 {
4579     auto* fullImpl = GetFullImpl();
4580     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputUserUnderlineColor(node->uiNodeHandle);
4581 }
4582 
SetTextInputEnableAutoFill(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4583 int32_t SetTextInputEnableAutoFill(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4584 {
4585     auto* fullImpl = GetFullImpl();
4586     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4587     if (actualSize < 0) {
4588         return ERROR_CODE_PARAM_INVALID;
4589     }
4590     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputEnableAutoFill(
4591         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4592     return ERROR_CODE_NO_ERROR;
4593 }
4594 
GetTextInputEnableAutoFill(ArkUI_NodeHandle node)4595 const ArkUI_AttributeItem* GetTextInputEnableAutoFill(ArkUI_NodeHandle node)
4596 {
4597     auto fullImpl = GetFullImpl();
4598     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputEnableAutoFill(
4599         node->uiNodeHandle);
4600     g_attributeItem.size = REQUIRED_ONE_PARAM;
4601     return &g_attributeItem;
4602 }
4603 
ResetTextInputEnableAutoFill(ArkUI_NodeHandle node)4604 void ResetTextInputEnableAutoFill(ArkUI_NodeHandle node)
4605 {
4606     auto* fullImpl = GetFullImpl();
4607     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputEnableAutoFill(node->uiNodeHandle);
4608 }
4609 
SetTextInputContentType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4610 int32_t SetTextInputContentType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4611 {
4612     auto* fullImpl = GetFullImpl();
4613     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4614     if (actualSize < 0) {
4615         return ERROR_CODE_PARAM_INVALID;
4616     }
4617     // The enum values of native_type.h are different from those of text_content_type.h. Convert the enum values.
4618     auto value = static_cast<uint32_t>(item->value[0].i32);
4619     if (value >= static_cast<uint32_t>(ARKUI_TEXTINPUT_CONTENT_TYPE_NICKNAME)
4620         && value <= static_cast<uint32_t>(ARKUI_TEXTINPUT_CONTENT_TYPE_FORMAT_ADDRESS)) {
4621         value += CONVERT_CONTENT_TYPE;
4622     }
4623     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputContentType(
4624         node->uiNodeHandle, value);
4625     return ERROR_CODE_NO_ERROR;
4626 }
4627 
GetTextInputContentType(ArkUI_NodeHandle node)4628 const ArkUI_AttributeItem* GetTextInputContentType(ArkUI_NodeHandle node)
4629 {
4630     auto fullImpl = GetFullImpl();
4631     auto value = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputContentType(
4632         node->uiNodeHandle);
4633     if (value >= static_cast<int32_t>(
4634                      static_cast<uint32_t>(ARKUI_TEXTINPUT_CONTENT_TYPE_FORMAT_ADDRESS) + CONVERT_CONTENT_TYPE) &&
4635         value <= static_cast<int32_t>(
4636                      static_cast<uint32_t>(ARKUI_TEXTINPUT_CONTENT_TYPE_FORMAT_ADDRESS) + CONVERT_CONTENT_TYPE)) {
4637         value -= CONVERT_CONTENT_TYPE;
4638     }
4639     g_numberValues[0].i32 = value;
4640     g_attributeItem.size = REQUIRED_ONE_PARAM;
4641     return &g_attributeItem;
4642 }
4643 
ResetTextInputContentType(ArkUI_NodeHandle node)4644 void ResetTextInputContentType(ArkUI_NodeHandle node)
4645 {
4646     auto* fullImpl = GetFullImpl();
4647     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputContentType(node->uiNodeHandle);
4648 }
4649 
SetTextInputPasswordRules(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4650 int32_t SetTextInputPasswordRules(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4651 {
4652     auto* fullImpl = GetFullImpl();
4653     ArkUI_CharPtr itemString = item->string;
4654     if(!itemString) {
4655         itemString = "";
4656     }
4657     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPasswordRules(
4658         node->uiNodeHandle, itemString);
4659     return ERROR_CODE_NO_ERROR;
4660 }
4661 
GetTextInputPasswordRules(ArkUI_NodeHandle node)4662 const ArkUI_AttributeItem* GetTextInputPasswordRules(ArkUI_NodeHandle node)
4663 {
4664     auto fullImpl = GetFullImpl();
4665     g_attributeItem.string = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputPasswordRules(
4666         node->uiNodeHandle);
4667     return &g_attributeItem;
4668 }
4669 
ResetTextInputPasswordRules(ArkUI_NodeHandle node)4670 void ResetTextInputPasswordRules(ArkUI_NodeHandle node)
4671 {
4672     auto* fullImpl = GetFullImpl();
4673     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputPasswordRules(node->uiNodeHandle);
4674 }
4675 
SetTextInputSelectAll(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4676 int32_t SetTextInputSelectAll(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4677 {
4678     auto* fullImpl = GetFullImpl();
4679     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4680     if (actualSize < 0) {
4681         return ERROR_CODE_PARAM_INVALID;
4682     }
4683     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputSelectAll(
4684         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4685     return ERROR_CODE_NO_ERROR;
4686 }
4687 
GetTextInputSelectAll(ArkUI_NodeHandle node)4688 const ArkUI_AttributeItem* GetTextInputSelectAll(ArkUI_NodeHandle node)
4689 {
4690     auto fullImpl = GetFullImpl();
4691     g_numberValues[NUM_0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputSelectAll(
4692         node->uiNodeHandle);
4693     g_attributeItem.size = REQUIRED_ONE_PARAM;
4694     return &g_attributeItem;
4695 }
4696 
ResetTextInputSelectAll(ArkUI_NodeHandle node)4697 void ResetTextInputSelectAll(ArkUI_NodeHandle node)
4698 {
4699     auto* fullImpl = GetFullImpl();
4700     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputSelectAll(node->uiNodeHandle);
4701 }
4702 
SetTextInputCaretOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4703 int32_t SetTextInputCaretOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4704 {
4705     auto* fullImpl = GetFullImpl();
4706     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4707     if (actualSize < 0) {
4708         return ERROR_CODE_PARAM_INVALID;
4709     }
4710     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCaretPosition(
4711         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4712     return ERROR_CODE_NO_ERROR;
4713 }
4714 
4715 
GetTextInputCaretOffset(ArkUI_NodeHandle node)4716 const ArkUI_AttributeItem* GetTextInputCaretOffset(ArkUI_NodeHandle node)
4717 {
4718     auto* fullImpl = GetFullImpl();
4719     g_numberValues[NUM_0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputCaretIndex(
4720         node->uiNodeHandle);
4721     ArkUI_Float32 values[NUM_2];
4722     fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputCaretOffset(node->uiNodeHandle, &values);
4723     g_numberValues[NUM_1].f32 = values[NUM_0];
4724     g_numberValues[NUM_2].f32 = values[NUM_1];
4725     g_attributeItem.size = REQUIRED_TWO_PARAM;
4726     return &g_attributeItem;
4727 }
4728 
ResetTextInputCaretOffset(ArkUI_NodeHandle node)4729 void ResetTextInputCaretOffset(ArkUI_NodeHandle node)
4730 {
4731     auto* fullImpl = GetFullImpl();
4732     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCaretPosition(node->uiNodeHandle);
4733 }
4734 
SetInputFilter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4735 int32_t SetInputFilter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4736 {
4737     auto* fullImpl = GetFullImpl();
4738     ArkUI_CharPtr itemString = item->string;
4739     if(!itemString) {
4740         itemString = "";
4741     }
4742     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputInputFilter(
4743         node->uiNodeHandle, itemString);
4744     return ERROR_CODE_NO_ERROR;
4745 }
4746 
GetInputFilter(ArkUI_NodeHandle node)4747 const ArkUI_AttributeItem* GetInputFilter(ArkUI_NodeHandle node)
4748 {
4749     auto fullImpl = GetFullImpl();
4750     g_attributeItem.string = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputInputFilter(
4751         node->uiNodeHandle);
4752     return &g_attributeItem;
4753 }
4754 
ResetInputFilter(ArkUI_NodeHandle node)4755 void ResetInputFilter(ArkUI_NodeHandle node)
4756 {
4757     auto* fullImpl = GetFullImpl();
4758     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputInputFilter(node->uiNodeHandle);
4759 }
4760 
SetTextInputStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4761 int32_t SetTextInputStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4762 {
4763     auto* fullImpl = GetFullImpl();
4764     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4765     if (actualSize < 0) {
4766         return ERROR_CODE_PARAM_INVALID;
4767     }
4768     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputStyle(
4769         node->uiNodeHandle, static_cast<int32_t>(item->value[0].i32));
4770     return ERROR_CODE_NO_ERROR;
4771 }
4772 
GetTextInputStyle(ArkUI_NodeHandle node)4773 const ArkUI_AttributeItem* GetTextInputStyle(ArkUI_NodeHandle node)
4774 {
4775     auto fullImpl = GetFullImpl();
4776     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputStyle(node->uiNodeHandle);
4777     g_attributeItem.size = REQUIRED_ONE_PARAM;
4778     return &g_attributeItem;
4779 }
4780 
ResetTextInputStyle(ArkUI_NodeHandle node)4781 void ResetTextInputStyle(ArkUI_NodeHandle node)
4782 {
4783     auto* fullImpl = GetFullImpl();
4784     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputStyle(node->uiNodeHandle);
4785 }
4786 
GetTextInputContentRect(ArkUI_NodeHandle node)4787 const ArkUI_AttributeItem* GetTextInputContentRect(ArkUI_NodeHandle node)
4788 {
4789     ArkUI_Float32 values[NUM_4];
4790     auto* fullImpl = GetFullImpl();
4791     fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputContentRect(node->uiNodeHandle, &values);
4792     g_numberValues[NUM_0].f32 = values[NUM_0];
4793     g_numberValues[NUM_1].f32 = values[NUM_1];
4794     g_numberValues[NUM_2].f32 = values[NUM_2];
4795     g_numberValues[NUM_3].f32 = values[NUM_3];
4796     g_attributeItem.size = REQUIRED_FOUR_PARAM;
4797     return &g_attributeItem;
4798 }
4799 
GetTextInputContentLineCount(ArkUI_NodeHandle node)4800 const ArkUI_AttributeItem* GetTextInputContentLineCount(ArkUI_NodeHandle node)
4801 {
4802     auto* fullImpl = GetFullImpl();
4803     g_numberValues[NUM_0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputContentLinesNum(
4804         node->uiNodeHandle);
4805     g_attributeItem.size = REQUIRED_ONE_PARAM;
4806     return &g_attributeItem;
4807 }
4808 
SetInputCustomKeyboard(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4809 int32_t SetInputCustomKeyboard(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4810 {
4811     if (!item->object) {
4812         return ERROR_CODE_PARAM_INVALID;
4813     }
4814     auto fullImpl = GetFullImpl();
4815     auto customKeyboard = reinterpret_cast<ArkUI_NodeHandle>(item->object);
4816     auto supportAvoidance = false;
4817     if (item->size > 0) {
4818         supportAvoidance = static_cast<bool>(item->value[0].i32);
4819     }
4820     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCustomKeyboard(
4821         node->uiNodeHandle, customKeyboard->uiNodeHandle, supportAvoidance);
4822     return ERROR_CODE_NO_ERROR;
4823 }
4824 
GetInputCustomKeyboard(ArkUI_NodeHandle node)4825 const ArkUI_AttributeItem* GetInputCustomKeyboard(ArkUI_NodeHandle node)
4826 {
4827     auto fullImpl = GetFullImpl();
4828     auto* value = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputCustomKeyboard(
4829         node->uiNodeHandle);
4830     void* attachNode = fullImpl->getExtendedAPI()->getAttachNodePtr(value);
4831     if (attachNode) {
4832         g_attributeItem.object = reinterpret_cast<ArkUI_NodeHandle>(attachNode);
4833     }
4834     g_numberValues[NUM_0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
4835         getTextInputCustomKeyboardOption(node->uiNodeHandle);
4836     g_attributeItem.size = REQUIRED_ONE_PARAM;
4837     return &g_attributeItem;
4838 }
4839 
ResetInputCustomKeyboard(ArkUI_NodeHandle node)4840 void ResetInputCustomKeyboard(ArkUI_NodeHandle node)
4841 {
4842     auto* fullImpl = GetFullImpl();
4843     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCustomKeyboard(node->uiNodeHandle);
4844 }
4845 
SetTextInputWordBreak(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4846 int32_t SetTextInputWordBreak(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4847 {
4848     auto* fullImpl = GetFullImpl();
4849     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4850     if (actualSize < 0) {
4851         return ERROR_CODE_PARAM_INVALID;
4852     }
4853     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputWordBreak(
4854         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4855     return ERROR_CODE_NO_ERROR;
4856 }
4857 
GetTextInputWordBreak(ArkUI_NodeHandle node)4858 const ArkUI_AttributeItem* GetTextInputWordBreak(ArkUI_NodeHandle node)
4859 {
4860     auto fullImpl = GetFullImpl();
4861     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputWordBreak(
4862         node->uiNodeHandle);
4863     g_attributeItem.size = REQUIRED_ONE_PARAM;
4864     return &g_attributeItem;
4865 }
4866 
ResetTextInputWordBreak(ArkUI_NodeHandle node)4867 void ResetTextInputWordBreak(ArkUI_NodeHandle node)
4868 {
4869     auto* fullImpl = GetFullImpl();
4870     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputWordBreak(node->uiNodeHandle);
4871 }
4872 
SetTextInputNumberOfLines(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4873 int32_t SetTextInputNumberOfLines(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4874 {
4875     auto* fullImpl = GetFullImpl();
4876     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4877     if (actualSize < 0) {
4878         return ERROR_CODE_PARAM_INVALID;
4879     }
4880     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputNumberOfLines(
4881         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4882     return ERROR_CODE_NO_ERROR;
4883 }
4884 
GetTextInputNumberOfLines(ArkUI_NodeHandle node)4885 const ArkUI_AttributeItem* GetTextInputNumberOfLines(ArkUI_NodeHandle node)
4886 {
4887     auto fullImpl = GetFullImpl();
4888     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputNumberOfLines(
4889         node->uiNodeHandle);
4890     g_attributeItem.size = REQUIRED_ONE_PARAM;
4891     return &g_attributeItem;
4892 }
4893 
ResetTextInputNumberOfLines(ArkUI_NodeHandle node)4894 void ResetTextInputNumberOfLines(ArkUI_NodeHandle node)
4895 {
4896     auto* fullImpl = GetFullImpl();
4897     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputNumberOfLines(node->uiNodeHandle);
4898 }
4899 
SetBlurOnSubmit(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4900 int32_t SetBlurOnSubmit(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4901 {
4902     auto actualSize = CheckAttributeItemArray(item, NUM_1);
4903     if (actualSize < 0) {
4904         return ERROR_CODE_PARAM_INVALID;
4905     }
4906     auto* fullImpl = GetFullImpl();
4907     fullImpl->getNodeModifiers()->getTextInputModifier()->setBlurOnSubmit(node->uiNodeHandle, item->value[0].i32);
4908     return ERROR_CODE_NO_ERROR;
4909 }
4910 
ResetBlurOnSubmit(ArkUI_NodeHandle node)4911 void ResetBlurOnSubmit(ArkUI_NodeHandle node)
4912 {
4913     auto* fullImpl = GetFullImpl();
4914     switch (node->type) {
4915         case ARKUI_NODE_TEXT_INPUT:
4916             fullImpl->getNodeModifiers()->getTextInputModifier()->setBlurOnSubmit(node->uiNodeHandle, true);
4917             break;
4918         case ARKUI_NODE_TEXT_AREA:
4919             fullImpl->getNodeModifiers()->getTextInputModifier()->setBlurOnSubmit(node->uiNodeHandle, false);
4920             break;
4921         default:
4922             break;
4923     }
4924 }
4925 
SetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4926 int32_t SetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4927 {
4928     auto* fullImpl = GetFullImpl();
4929     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4930     if (actualSize < 0) {
4931         return ERROR_CODE_PARAM_INVALID;
4932     }
4933     fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputShowKeyBoardOnFocus(
4934         node->uiNodeHandle, item->value[0].i32);
4935     return ERROR_CODE_NO_ERROR;
4936 }
4937 
GetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node)4938 const ArkUI_AttributeItem* GetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node)
4939 {
4940     auto fullImpl = GetFullImpl();
4941     g_numberValues[0].i32 =
4942         fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputShowKeyBoardOnFocus(node->uiNodeHandle);
4943     g_attributeItem.size = REQUIRED_ONE_PARAM;
4944     return &g_attributeItem;
4945 }
4946 
ResetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node)4947 void ResetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node)
4948 {
4949     auto* fullImpl = GetFullImpl();
4950     fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputShowKeyBoardOnFocus(node->uiNodeHandle);
4951 }
4952 
GetBlurOnSubmit(ArkUI_NodeHandle node)4953 const ArkUI_AttributeItem* GetBlurOnSubmit(ArkUI_NodeHandle node)
4954 {
4955     auto* fullImpl = GetFullImpl();
4956     g_numberValues[0].i32 =
4957         fullImpl->getNodeModifiers()->getTextInputModifier()->getBlurOnSubmit(node->uiNodeHandle);
4958     g_attributeItem.size = REQUIRED_ONE_PARAM;
4959     return &g_attributeItem;
4960 }
4961 // Stack Attribute functions
SetAlignContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4962 int32_t SetAlignContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4963 {
4964     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4965     if (actualSize < 0 || !InRegion(NUM_0, NUM_8, item->value[0].i32)) {
4966         return ERROR_CODE_PARAM_INVALID;
4967     }
4968     auto fullImpl = GetFullImpl();
4969     auto attrVal = item->value[NUM_0].i32;
4970     fullImpl->getNodeModifiers()->getStackModifier()->setAlignContent(node->uiNodeHandle, attrVal);
4971     return ERROR_CODE_NO_ERROR;
4972 }
4973 
GetAlignContent(ArkUI_NodeHandle node)4974 const ArkUI_AttributeItem* GetAlignContent(ArkUI_NodeHandle node)
4975 {
4976     auto fullImpl = GetFullImpl();
4977     auto alignContent = fullImpl->getNodeModifiers()->getStackModifier()->getAlignContent(node->uiNodeHandle);
4978     g_numberValues[0].i32 = alignContent;
4979     g_attributeItem.size = REQUIRED_ONE_PARAM;
4980     return &g_attributeItem;
4981 }
4982 
ResetAlignContent(ArkUI_NodeHandle node)4983 void ResetAlignContent(ArkUI_NodeHandle node)
4984 {
4985     // already check in entry point.
4986     auto* fullImpl = GetFullImpl();
4987 
4988     fullImpl->getNodeModifiers()->getStackModifier()->resetAlignContent(node->uiNodeHandle);
4989 }
4990 
GetScrollFriction(ArkUI_NodeHandle node)4991 const ArkUI_AttributeItem* GetScrollFriction(ArkUI_NodeHandle node)
4992 {
4993     if (node->type == ARKUI_NODE_LIST) {
4994         g_numberValues[0].f32 =
4995             GetFullImpl()->getNodeModifiers()->getListModifier()->getListFriction(node->uiNodeHandle);
4996     } else if (node->type == ARKUI_NODE_SCROLL) {
4997         g_numberValues[0].f32 =
4998             GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollFriction(node->uiNodeHandle);
4999     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5000         g_numberValues[0].f32 =
5001             GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowFriction(node->uiNodeHandle);
5002     }
5003     return &g_attributeItem;
5004 }
5005 
SetScrollFriction(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5006 int32_t SetScrollFriction(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5007 {
5008     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5009     if (actualSize < 0 || LessOrEqual(item->value[NUM_0].f32, 0.0f)) {
5010         return ERROR_CODE_PARAM_INVALID;
5011     }
5012     auto fullImpl = GetFullImpl();
5013     auto friction = item->value[NUM_0].f32;
5014     if (node->type == ARKUI_NODE_LIST) {
5015         fullImpl->getNodeModifiers()->getListModifier()->setListFriction(node->uiNodeHandle, friction);
5016     } else if (node->type == ARKUI_NODE_SCROLL) {
5017         fullImpl->getNodeModifiers()->getScrollModifier()->setScrollFriction(node->uiNodeHandle, friction);
5018     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5019         fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowFriction(node->uiNodeHandle, friction);
5020     }
5021     return ERROR_CODE_NO_ERROR;
5022 }
5023 
ResetScrollFriction(ArkUI_NodeHandle node)5024 void ResetScrollFriction(ArkUI_NodeHandle node)
5025 {
5026     // already check in entry point.
5027     auto* fullImpl = GetFullImpl();
5028 
5029     if (node->type == ARKUI_NODE_LIST) {
5030         fullImpl->getNodeModifiers()->getListModifier()->resetListFriction(node->uiNodeHandle);
5031     } else if (node->type == ARKUI_NODE_SCROLL) {
5032         fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollFriction(node->uiNodeHandle);
5033     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5034         fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowFriction(node->uiNodeHandle);
5035     }
5036 }
5037 
GetScrollScrollSnap(ArkUI_NodeHandle node)5038 const ArkUI_AttributeItem* GetScrollScrollSnap(ArkUI_NodeHandle node)
5039 {
5040     ArkUI_Float32 values[32];
5041     auto size =
5042         GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollSnap(node->uiNodeHandle, &values);
5043 
5044     //size index
5045     g_numberValues[NUM_0].i32 = values[NUM_0];
5046     g_numberValues[NUM_1].i32 = values[NUM_1];
5047     g_numberValues[NUM_2].i32 = values[NUM_2];
5048     for (auto i = NUM_3; i < size; i++) {
5049         g_numberValues[i].f32 = values[i];
5050     }
5051     g_attributeItem.size = size;
5052     return &g_attributeItem;
5053 }
5054 
SetScrollScrollSnap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5055 int32_t SetScrollScrollSnap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5056 {
5057     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
5058     if (actualSize < 0 || !InRegion(NUM_0, NUM_3, item->value[NUM_0].i32) ||
5059         !InRegion(NUM_0, NUM_1, item->value[NUM_1].i32) || !InRegion(NUM_0, NUM_1, item->value[NUM_2].i32)) {
5060         return ERROR_CODE_PARAM_INVALID;
5061     }
5062     auto fullImpl = GetFullImpl();
5063     auto snapAlign = item->value[NUM_0].i32;
5064     auto enableSnapToStart = item->value[NUM_1].i32;
5065     auto enableSnapToEnd = item->value[NUM_2].i32;
5066 
5067     ArkUI_Float32 paginations[item->size - NUM_3];
5068     ArkUI_Int32 paginationParams[item->size + NUM_1];
5069     int32_t unit = GetDefaultUnit(node, UNIT_VP);
5070     for (int i = 0; i < item->size - NUM_3; ++i) {
5071         if (LessNotEqual(item->value[i + NUM_3].f32, 0.0f)) {
5072             return ERROR_CODE_PARAM_INVALID;
5073         }
5074         paginations[i] = item->value[i + NUM_3].f32;
5075         paginationParams[i] = unit;
5076     }
5077 
5078     paginationParams[item->size - NUM_3 + NUM_0] = snapAlign;
5079     paginationParams[item->size - NUM_3 + NUM_1] = enableSnapToStart;
5080     paginationParams[item->size - NUM_3 + NUM_2] = enableSnapToEnd;
5081     paginationParams[item->size] = (item->size - NUM_3 > 1) ? true : false;
5082 
5083     fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollSnap(
5084         node->uiNodeHandle, paginations, item->size - NUM_3, paginationParams, item->size + NUM_1);
5085     return ERROR_CODE_NO_ERROR;
5086 }
5087 
ResetScrollScrollSnap(ArkUI_NodeHandle node)5088 void ResetScrollScrollSnap(ArkUI_NodeHandle node)
5089 {
5090     // already check in entry point.
5091     auto* fullImpl = GetFullImpl();
5092 
5093     fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollSnap(node->uiNodeHandle);
5094 }
5095 
GetScrollScrollBar(ArkUI_NodeHandle node)5096 const ArkUI_AttributeItem* GetScrollScrollBar(ArkUI_NodeHandle node)
5097 {
5098     if (node->type == ARKUI_NODE_LIST) {
5099         g_numberValues[0].i32 =
5100             GetFullImpl()->getNodeModifiers()->getListModifier()->getListScrollBar(node->uiNodeHandle);
5101     } else if (node->type == ARKUI_NODE_SCROLL) {
5102         g_numberValues[0].i32 =
5103             GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollBar(node->uiNodeHandle);
5104     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5105         g_numberValues[0].i32 =
5106             GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowScrollBar(node->uiNodeHandle);
5107     }
5108     return &g_attributeItem;
5109 }
5110 
SetScrollScrollBar(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5111 int32_t SetScrollScrollBar(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5112 {
5113     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5114     if (actualSize < 0 || !InRegion(NUM_0, NUM_2, item->value[NUM_0].i32)) {
5115         return ERROR_CODE_PARAM_INVALID;
5116     }
5117     auto fullImpl = GetFullImpl();
5118     auto attrVal = item->value[NUM_0].i32;
5119     if (node->type == ARKUI_NODE_LIST) {
5120         fullImpl->getNodeModifiers()->getListModifier()->setListScrollBar(node->uiNodeHandle, attrVal);
5121     } else if (node->type == ARKUI_NODE_SCROLL) {
5122         fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollBar(node->uiNodeHandle, attrVal);
5123     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5124         fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowScrollBar(node->uiNodeHandle, attrVal);
5125     }
5126     return ERROR_CODE_NO_ERROR;
5127 }
5128 
ResetScrollScrollBar(ArkUI_NodeHandle node)5129 void ResetScrollScrollBar(ArkUI_NodeHandle node)
5130 {
5131     // already check in entry point.
5132     auto* fullImpl = GetFullImpl();
5133 
5134     if (node->type == ARKUI_NODE_LIST) {
5135         fullImpl->getNodeModifiers()->getListModifier()->resetListScrollBar(node->uiNodeHandle);
5136     } else if (node->type == ARKUI_NODE_SCROLL) {
5137         fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollBar(node->uiNodeHandle);
5138     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5139         fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowScrollBar(node->uiNodeHandle);
5140     }
5141 }
5142 
GetScrollScrollBarWidth(ArkUI_NodeHandle node)5143 const ArkUI_AttributeItem* GetScrollScrollBarWidth(ArkUI_NodeHandle node)
5144 {
5145     if (node->type == ARKUI_NODE_LIST) {
5146         g_numberValues[0].f32 =
5147             GetFullImpl()->getNodeModifiers()->getListModifier()->getListScrollBarWidth(node->uiNodeHandle);
5148     } else if (node->type == ARKUI_NODE_SCROLL) {
5149         g_numberValues[0].f32 =
5150             GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollBarWidth(node->uiNodeHandle);
5151     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5152         g_numberValues[0].f32 =
5153             GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowScrollBarWidth(node->uiNodeHandle);
5154     }
5155     return &g_attributeItem;
5156 }
5157 
SetScrollScrollBarWidth(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5158 int32_t SetScrollScrollBarWidth(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5159 {
5160     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5161     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, NUM_0)) {
5162         return ERROR_CODE_PARAM_INVALID;
5163     }
5164     auto fullImpl = GetFullImpl();
5165     auto attrVal = item->value[NUM_0].f32;
5166     int32_t unit = GetDefaultUnit(node, UNIT_VP);
5167     if (node->type == ARKUI_NODE_LIST) {
5168         auto width = std::to_string(attrVal) + LENGTH_METRIC_UNIT[unit];
5169         fullImpl->getNodeModifiers()->getListModifier()->setListScrollBarWidth(node->uiNodeHandle, width.c_str());
5170     } else if (node->type == ARKUI_NODE_SCROLL) {
5171         fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollBarWidth(node->uiNodeHandle, attrVal, unit);
5172     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5173         auto width = std::to_string(attrVal) + LENGTH_METRIC_UNIT[unit];
5174         fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowScrollBarWidth(
5175             node->uiNodeHandle, width.c_str());
5176     }
5177     return ERROR_CODE_NO_ERROR;
5178 }
5179 
ResetScrollScrollBarWidth(ArkUI_NodeHandle node)5180 void ResetScrollScrollBarWidth(ArkUI_NodeHandle node)
5181 {
5182     // already check in entry point.
5183     auto* fullImpl = GetFullImpl();
5184     if (node->type == ARKUI_NODE_LIST) {
5185         fullImpl->getNodeModifiers()->getListModifier()->resetListScrollBarWidth(node->uiNodeHandle);
5186     } else if (node->type == ARKUI_NODE_SCROLL) {
5187         fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollBarWidth(node->uiNodeHandle);
5188     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5189         fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowScrollBarWidth(node->uiNodeHandle);
5190     }
5191 }
5192 
GetScrollScrollBarColor(ArkUI_NodeHandle node)5193 const ArkUI_AttributeItem* GetScrollScrollBarColor(ArkUI_NodeHandle node)
5194 {
5195     if (node->type == ARKUI_NODE_LIST) {
5196         g_numberValues[0].u32 =
5197             GetFullImpl()->getNodeModifiers()->getListModifier()->getListScrollBarColor(node->uiNodeHandle);
5198     } else if (node->type == ARKUI_NODE_SCROLL) {
5199         g_numberValues[0].u32 =
5200             GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollBarColor(node->uiNodeHandle);
5201     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5202         g_numberValues[0].u32 =
5203             GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowScrollBarColor(node->uiNodeHandle);
5204     }
5205     return &g_attributeItem;
5206 }
5207 
SetScrollScrollBarColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5208 int32_t SetScrollScrollBarColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5209 {
5210     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5211     if (actualSize < 0) {
5212         return ERROR_CODE_PARAM_INVALID;
5213     }
5214     auto fullImpl = GetFullImpl();
5215     auto color = item->value[NUM_0].u32;
5216     if (node->type == ARKUI_NODE_LIST) {
5217         auto value = Color(color).ColorToString();
5218         fullImpl->getNodeModifiers()->getListModifier()->setListScrollBarColor(node->uiNodeHandle, value.c_str());
5219     } else if (node->type == ARKUI_NODE_SCROLL) {
5220         fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollBarColor(node->uiNodeHandle, color);
5221     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5222         auto value = Color(color).ColorToString();
5223         fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowScrollBarColor(
5224             node->uiNodeHandle, value.c_str());
5225     }
5226     return ERROR_CODE_NO_ERROR;
5227 }
5228 
ResetScrollScrollBarColor(ArkUI_NodeHandle node)5229 void ResetScrollScrollBarColor(ArkUI_NodeHandle node)
5230 {
5231     // already check in entry point.
5232     auto* fullImpl = GetFullImpl();
5233 
5234     if (node->type == ARKUI_NODE_LIST) {
5235         fullImpl->getNodeModifiers()->getListModifier()->resetListScrollBarColor(node->uiNodeHandle);
5236     } else if (node->type == ARKUI_NODE_SCROLL) {
5237         fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollBarColor(node->uiNodeHandle);
5238     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5239         fullImpl->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowScrollBarColor(node->uiNodeHandle);
5240     }
5241 }
5242 
GetScrollScrollable(ArkUI_NodeHandle node)5243 const ArkUI_AttributeItem* GetScrollScrollable(ArkUI_NodeHandle node)
5244 {
5245     auto value = GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollable(node->uiNodeHandle);
5246     g_numberValues[0].i32 = value;
5247     return &g_attributeItem;
5248 }
5249 
SetScrollScrollable(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5250 int32_t SetScrollScrollable(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5251 {
5252     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5253     if (actualSize < 0 || !InRegion(NUM_0, NUM_3, item->value[0].i32)) {
5254         return ERROR_CODE_PARAM_INVALID;
5255     }
5256     auto fullImpl = GetFullImpl();
5257     auto attrVal = item->value[NUM_0].i32;
5258     fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollable(node->uiNodeHandle, attrVal);
5259     return ERROR_CODE_NO_ERROR;
5260 }
5261 
ResetScrollScrollable(ArkUI_NodeHandle node)5262 void ResetScrollScrollable(ArkUI_NodeHandle node)
5263 {
5264     // already check in entry point.
5265     auto* fullImpl = GetFullImpl();
5266 
5267     fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollable(node->uiNodeHandle);
5268 }
5269 
GetScrollEdgeEffect(ArkUI_NodeHandle node)5270 const ArkUI_AttributeItem* GetScrollEdgeEffect(ArkUI_NodeHandle node)
5271 {
5272     ArkUI_Int32 values[2];
5273     if (node->type == ARKUI_NODE_LIST) {
5274         auto valueSize =
5275             GetFullImpl()->getNodeModifiers()->getListModifier()->getListEdgeEffect(node->uiNodeHandle, &values);
5276         for (int i = 0; i < valueSize; i++) {
5277             g_numberValues[i].i32 = values[i];
5278         }
5279         g_attributeItem.size = valueSize;
5280     } else if (node->type == ARKUI_NODE_SCROLL) {
5281         auto valueSize =
5282             GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollEdgeEffect(node->uiNodeHandle, &values);
5283         for (int i = 0; i < valueSize; i++) {
5284             g_numberValues[i].i32 = values[i];
5285         }
5286         g_attributeItem.size = valueSize;
5287     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5288         auto valueSize =
5289             GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getEdgeEffect(node->uiNodeHandle, &values);
5290         for (int i = 0; i < valueSize; i++) {
5291             g_numberValues[i].i32 = values[i];
5292         }
5293         g_attributeItem.size = valueSize;
5294     }
5295     return &g_attributeItem;
5296 }
5297 
SetScrollEdgeEffect(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5298 int32_t SetScrollEdgeEffect(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5299 {
5300     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5301     if (actualSize < 0 || !InRegion(NUM_0, NUM_2, item->value[0].i32) ||
5302         (item->size > NUM_1 && !InRegion(NUM_0, NUM_1, item->value[1].i32))) {
5303         return ERROR_CODE_PARAM_INVALID;
5304     }
5305     auto fullImpl = GetFullImpl();
5306     auto attrVal = item->value[NUM_0].i32;
5307     bool alwaysEnabled = false;
5308     if (item->size > NUM_1) {
5309         alwaysEnabled = item->value[NUM_1].i32;
5310     } else if (node->type == ARKUI_NODE_SCROLL) {
5311         alwaysEnabled = true;
5312     }
5313     if (node->type == ARKUI_NODE_LIST) {
5314         fullImpl->getNodeModifiers()->getListModifier()->setListEdgeEffect(node->uiNodeHandle, attrVal, alwaysEnabled);
5315     } else if (node->type == ARKUI_NODE_SCROLL) {
5316         fullImpl->getNodeModifiers()->getScrollModifier()->setScrollEdgeEffect(
5317             node->uiNodeHandle, attrVal, alwaysEnabled);
5318     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5319         fullImpl->getNodeModifiers()->getWaterFlowModifier()->setEdgeEffect(
5320             node->uiNodeHandle, attrVal, alwaysEnabled);
5321     }
5322     return ERROR_CODE_NO_ERROR;
5323 }
5324 
ResetScrollEdgeEffect(ArkUI_NodeHandle node)5325 void ResetScrollEdgeEffect(ArkUI_NodeHandle node)
5326 {
5327     // already check in entry point.
5328     auto* fullImpl = GetFullImpl();
5329 
5330     if (node->type == ARKUI_NODE_LIST) {
5331         fullImpl->getNodeModifiers()->getListModifier()->resetListEdgeEffect(node->uiNodeHandle);
5332     } else if (node->type == ARKUI_NODE_SCROLL) {
5333         fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollEdgeEffect(node->uiNodeHandle);
5334     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5335         fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetEdgeEffect(node->uiNodeHandle);
5336     }
5337 }
5338 
GetScrollEnableScrollInteraction(ArkUI_NodeHandle node)5339 const ArkUI_AttributeItem* GetScrollEnableScrollInteraction(ArkUI_NodeHandle node)
5340 {
5341     if (node->type == ARKUI_NODE_LIST) {
5342         g_numberValues[0].i32 =
5343             GetFullImpl()->getNodeModifiers()->getListModifier()->getEnableScrollInteraction(node->uiNodeHandle);
5344     } else if (node->type == ARKUI_NODE_SCROLL) {
5345         g_numberValues[0].i32 =
5346             GetFullImpl()->getNodeModifiers()->getScrollModifier()->getEnableScrollInteraction(node->uiNodeHandle);
5347     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5348         g_numberValues[0].i32 =
5349             GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowEnableScrollInteraction(
5350                 node->uiNodeHandle);
5351     }
5352     return &g_attributeItem;
5353 }
5354 
SetScrollEnableScrollInteraction(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5355 int32_t SetScrollEnableScrollInteraction(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5356 {
5357     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5358     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
5359         return ERROR_CODE_PARAM_INVALID;
5360     }
5361     auto fullImpl = GetFullImpl();
5362     bool enableScrollInteraction = item->value[NUM_0].i32;
5363     if (node->type == ARKUI_NODE_LIST) {
5364         fullImpl->getNodeModifiers()->getListModifier()->setEnableScrollInteraction(
5365             node->uiNodeHandle, enableScrollInteraction);
5366     } else if (node->type == ARKUI_NODE_SCROLL) {
5367         fullImpl->getNodeModifiers()->getScrollModifier()->setEnableScrollInteraction(
5368             node->uiNodeHandle, enableScrollInteraction);
5369     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5370         fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowEnableScrollInteraction(
5371             node->uiNodeHandle, enableScrollInteraction);
5372     }
5373     return ERROR_CODE_NO_ERROR;
5374 }
5375 
ResetScrollEnableScrollInteraction(ArkUI_NodeHandle node)5376 void ResetScrollEnableScrollInteraction(ArkUI_NodeHandle node)
5377 {
5378     // already check in entry point.
5379     auto* fullImpl = GetFullImpl();
5380 
5381     if (node->type == ARKUI_NODE_LIST) {
5382         fullImpl->getNodeModifiers()->getListModifier()->resetEnableScrollInteraction(node->uiNodeHandle);
5383     } else if (node->type == ARKUI_NODE_SCROLL) {
5384         fullImpl->getNodeModifiers()->getScrollModifier()->resetEnableScrollInteraction(node->uiNodeHandle);
5385     } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5386         fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowEnableScrollInteraction(node->uiNodeHandle);
5387     }
5388 }
5389 
SetScrollNestedScroll(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5390 int32_t SetScrollNestedScroll(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5391 {
5392     // The size must be greater than 2 and check value is Nested Mode
5393     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
5394     if (actualSize < 0 || !CheckAttributeIsScrollNestedMode(item->value[0].i32) ||
5395         !CheckAttributeIsScrollNestedMode(item->value[1].i32)) {
5396         return ERROR_CODE_PARAM_INVALID;
5397     }
5398     auto* fullImpl = GetFullImpl();
5399     int first = item->value[NUM_0].i32;
5400     int second = item->value[NUM_1].i32;
5401     if (node->type == ARKUI_NODE_WATER_FLOW) {
5402         fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowNestedScroll(
5403             node->uiNodeHandle, first, second);
5404     } else if (node->type == ARKUI_NODE_LIST) {
5405         fullImpl->getNodeModifiers()->getListModifier()->setListNestedScroll(node->uiNodeHandle, first, second);
5406     } else {
5407         fullImpl->getNodeModifiers()->getScrollModifier()->setScrollNestedScroll(node->uiNodeHandle, first, second);
5408     }
5409     return ERROR_CODE_NO_ERROR;
5410 }
5411 
GetScrollNestedScroll(ArkUI_NodeHandle node)5412 const ArkUI_AttributeItem* GetScrollNestedScroll(ArkUI_NodeHandle node)
5413 {
5414     ArkUI_Int32 values[2];
5415     if (node->type == ARKUI_NODE_WATER_FLOW) {
5416         GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowNestedScroll(
5417             node->uiNodeHandle, &values);
5418     } else if (node->type == ARKUI_NODE_LIST) {
5419         GetFullImpl()->getNodeModifiers()->getListModifier()->getListNestedScroll(node->uiNodeHandle, &values);
5420     } else {
5421         GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollNestedScroll(node->uiNodeHandle, &values);
5422     }
5423     //size index
5424     g_numberValues[0].i32 = values[0];
5425     g_numberValues[1].i32 = values[1];
5426     g_attributeItem.size = ALLOW_SIZE_2;
5427     return &g_attributeItem;
5428 }
5429 
ResetScrollNestedScroll(ArkUI_NodeHandle node)5430 void ResetScrollNestedScroll(ArkUI_NodeHandle node)
5431 {
5432     auto* fullImpl = GetFullImpl();
5433     if (node->type == ARKUI_NODE_WATER_FLOW) {
5434         fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowNestedScroll(node->uiNodeHandle);
5435     } else if (node->type == ARKUI_NODE_LIST) {
5436         GetFullImpl()->getNodeModifiers()->getListModifier()->resetListNestedScroll(node->uiNodeHandle);
5437     } else {
5438         fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollNestedScroll(node->uiNodeHandle);
5439     }
5440 }
5441 
SetScrollTo(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5442 int32_t SetScrollTo(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5443 {
5444     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
5445     if (actualSize < 0) {
5446         return ERROR_CODE_PARAM_INVALID;
5447     }
5448     auto* fullImpl = GetFullImpl();
5449     int32_t defaultUnit = GetDefaultUnit(node, UNIT_VP);
5450     ArkUI_Float32 values[ALLOW_SIZE_8] = { 0.0, defaultUnit, 0.0, defaultUnit, DEFAULT_DURATION, 1, 0.0, 0.0 };
5451     values[0] = item->value[0].f32;
5452     values[1] = defaultUnit;
5453     values[2] = item->value[1].f32;
5454     values[NUM_3] = defaultUnit;
5455     if (item->size > 2) {
5456         values[NUM_4] = static_cast<ArkUI_Float32>(item->value[NUM_2].i32);
5457     }
5458     // check size
5459     if (item->size > NUM_3 && CheckAttributeIsAnimationCurve(item->value[NUM_3].i32)) {
5460         values[NUM_5] = static_cast<ArkUI_Float32>(item->value[NUM_3].i32);
5461     }
5462     if (item->size > 4) {
5463         values[NUM_6] = static_cast<ArkUI_Float32>(item->value[NUM_4].i32);
5464     }
5465     if (item->size > NUM_5) {
5466         values[NUM_7] = static_cast<ArkUI_Float32>(item->value[NUM_5].i32);
5467     }
5468     fullImpl->getNodeModifiers()->getScrollModifier()->setScrollTo(node->uiNodeHandle, &values);
5469     return ERROR_CODE_NO_ERROR;
5470 }
5471 
GetScrollOffset(ArkUI_NodeHandle node)5472 const ArkUI_AttributeItem* GetScrollOffset(ArkUI_NodeHandle node)
5473 {
5474     ArkUI_Float32 values[2];
5475     GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollOffset(node->uiNodeHandle, &values);
5476     //size index
5477     g_numberValues[0].f32 = values[0];
5478     g_numberValues[1].f32 = values[1];
5479     g_attributeItem.size = ALLOW_SIZE_2;
5480     return &g_attributeItem;
5481 }
5482 
ResetScrollTo(ArkUI_NodeHandle node)5483 void ResetScrollTo(ArkUI_NodeHandle node)
5484 {
5485     auto* fullImpl = GetFullImpl();
5486     fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollTo(node->uiNodeHandle);
5487 }
5488 
SetScrollEdge(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5489 int32_t SetScrollEdge(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5490 {
5491     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5492     if (actualSize < 0) {
5493         return ERROR_CODE_PARAM_INVALID;
5494     }
5495     auto* fullImpl = GetFullImpl();
5496     fullImpl->getNodeModifiers()->getScrollModifier()->setScrollEdge(node->uiNodeHandle, item->value[0].i32);
5497     return ERROR_CODE_NO_ERROR;
5498 }
5499 
GetScrollEdge(ArkUI_NodeHandle node)5500 const ArkUI_AttributeItem* GetScrollEdge(ArkUI_NodeHandle node)
5501 {
5502     auto resultValue = GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollEdge(node->uiNodeHandle);
5503     //size index
5504     g_numberValues[0].i32 = resultValue;
5505     return &g_attributeItem;
5506 }
5507 
ResetScrollEdge(ArkUI_NodeHandle node)5508 void ResetScrollEdge(ArkUI_NodeHandle node)
5509 {
5510     auto* fullImpl = GetFullImpl();
5511     fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollEdge(node->uiNodeHandle);
5512 }
5513 
GetScrollEnablePaging(ArkUI_NodeHandle node)5514 const ArkUI_AttributeItem* GetScrollEnablePaging(ArkUI_NodeHandle node)
5515 {
5516     auto value = GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollEnablePaging(node->uiNodeHandle);
5517     //ScrollPagingStatus::VALID is true and VALID value is 2, others is false
5518     g_numberValues[0].i32 = value == NUM_2 ? true : false;
5519     return &g_attributeItem;
5520 }
5521 
SetScrollEnablePaging(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5522 int32_t SetScrollEnablePaging(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5523 {
5524     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5525     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
5526         return ERROR_CODE_PARAM_INVALID;
5527     }
5528     auto fullImpl = GetFullImpl();
5529     fullImpl->getNodeModifiers()->getScrollModifier()->setScrollEnablePaging(
5530         node->uiNodeHandle, item->value[NUM_0].i32);
5531     return ERROR_CODE_NO_ERROR;
5532 }
5533 
ResetScrollEnablePaging(ArkUI_NodeHandle node)5534 void ResetScrollEnablePaging(ArkUI_NodeHandle node)
5535 {
5536     // already check in entry point.
5537     auto* fullImpl = GetFullImpl();
5538 
5539     fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollEnablePaging(node->uiNodeHandle);
5540 }
5541 
SetScrollPage(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5542 int32_t SetScrollPage(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5543 {
5544     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5545     if (actualSize < NUM_0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
5546         return ERROR_CODE_PARAM_INVALID;
5547     }
5548     ArkUI_Int32 values[ALLOW_SIZE_2] = { NUM_0, DEFAULT_FALSE };
5549     values[NUM_0] = item->value[NUM_0].i32;
5550     if (item->size > NUM_1 && InRegion(NUM_0, NUM_1, item->value[NUM_1].i32)) {
5551         values[NUM_1] = item->value[NUM_1].i32;
5552     }
5553     auto* fullImpl = GetFullImpl();
5554     fullImpl->getNodeModifiers()->getScrollModifier()->setScrollPage(node->uiNodeHandle, values[NUM_0], values[NUM_1]);
5555     return ERROR_CODE_NO_ERROR;
5556 }
5557 
SetScrollBy(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5558 int32_t SetScrollBy(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5559 {
5560     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
5561     if (actualSize < NUM_0) {
5562         return ERROR_CODE_PARAM_INVALID;
5563     }
5564     DimensionUnit unit = static_cast<DimensionUnit>(GetDefaultUnit(node, UNIT_VP));
5565     if (unit != DimensionUnit::VP && unit != DimensionUnit::PX) {
5566         return ERROR_CODE_PARAM_INVALID;
5567     }
5568     double x = item->value[NUM_0].f32;
5569     double y = item->value[NUM_1].f32;
5570     if (unit == DimensionUnit::VP) {
5571         x = OHOS::Ace::NodeModel::GetFullImpl()->getBasicAPI()->convertLengthMetricsUnit(
5572             x, static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_VP), static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_PX));
5573         y = OHOS::Ace::NodeModel::GetFullImpl()->getBasicAPI()->convertLengthMetricsUnit(
5574             y, static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_VP), static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_PX));
5575     }
5576     auto* fullImpl = GetFullImpl();
5577     if (node->type == ARKUI_NODE_SCROLL || node->type == ARKUI_NODE_WATER_FLOW) {
5578         fullImpl->getNodeModifiers()->getScrollModifier()->setScrollBy(node->uiNodeHandle, x, y);
5579     } else if (node->type == ARKUI_NODE_LIST) {
5580         fullImpl->getNodeModifiers()->getListModifier()->setScrollBy(node->uiNodeHandle, x, y);
5581     } else {
5582         return ERROR_CODE_PARAM_INVALID;
5583     }
5584     return ERROR_CODE_NO_ERROR;
5585 }
5586 
SetScrollFling(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5587 int32_t SetScrollFling(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5588 {
5589     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5590     if (actualSize < NUM_0) {
5591         return ERROR_CODE_PARAM_INVALID;
5592     }
5593     DimensionUnit unit = static_cast<DimensionUnit>(GetDefaultUnit(node, UNIT_VP));
5594     if (unit != DimensionUnit::VP && unit != DimensionUnit::PX) {
5595         return ERROR_CODE_PARAM_INVALID;
5596     }
5597     double value = item->value[NUM_0].f32;
5598     if (unit == DimensionUnit::VP) {
5599         value = OHOS::Ace::NodeModel::GetFullImpl()->getBasicAPI()->convertLengthMetricsUnit(value,
5600             static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_VP), static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_PX));
5601     }
5602     auto* fullImpl = GetFullImpl();
5603     fullImpl->getNodeModifiers()->getScrollModifier()->setScrollFling(node->uiNodeHandle, value);
5604     return ERROR_CODE_NO_ERROR;
5605 }
5606 
SetScrollFadingEdge(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5607 int32_t SetScrollFadingEdge(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5608 {
5609     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5610     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
5611         return ERROR_CODE_PARAM_INVALID;
5612     }
5613     bool fadingEdge = item->value[NUM_0].i32;
5614     float fadingEdgeLengthValue = DEFAULT_SCROLL_FADING_EDGE_LENGTH;
5615     int32_t unit = UNIT_VP;
5616     if (fadingEdge && item->size > NUM_1 && GreatNotEqual(item->value[NUM_1].f32, 0.f)) {
5617         fadingEdgeLengthValue = item->value[NUM_1].f32;
5618         unit = GetDefaultUnit(node, UNIT_VP);
5619     }
5620     auto* fullImpl = GetFullImpl();
5621     fullImpl->getNodeModifiers()->getScrollModifier()->setScrollFadingEdge(node->uiNodeHandle,
5622         fadingEdge, fadingEdgeLengthValue, unit);
5623     return ERROR_CODE_NO_ERROR;
5624 }
5625 
GetScrollFadingEdge(ArkUI_NodeHandle node)5626 const ArkUI_AttributeItem* GetScrollFadingEdge(ArkUI_NodeHandle node)
5627 {
5628     ArkUIInt32orFloat32 values[NUM_2];
5629     GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollFadingEdge(node->uiNodeHandle, &values);
5630     g_numberValues[NUM_0].i32 = values[NUM_0].i32;
5631     g_numberValues[NUM_1].f32 = values[NUM_1].f32;
5632     return &g_attributeItem;
5633 }
5634 
ResetScrollFadingEdge(ArkUI_NodeHandle node)5635 void ResetScrollFadingEdge(ArkUI_NodeHandle node)
5636 {
5637     // already check in entry point.
5638     auto* fullImpl = GetFullImpl();
5639     fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollFadingEdge(node->uiNodeHandle);
5640 }
5641 
GetScrollContentSize(ArkUI_NodeHandle node)5642 const ArkUI_AttributeItem* GetScrollContentSize(ArkUI_NodeHandle node)
5643 {
5644     ArkUI_Float32 values[NUM_2];
5645     GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollContentSize(node->uiNodeHandle, &values);
5646     g_numberValues[NUM_0].f32 = values[NUM_0];
5647     g_numberValues[NUM_1].f32 = values[NUM_1];
5648     return &g_attributeItem;
5649 }
5650 
GetListDirection(ArkUI_NodeHandle node)5651 const ArkUI_AttributeItem* GetListDirection(ArkUI_NodeHandle node)
5652 {
5653     auto value = GetFullImpl()->getNodeModifiers()->getListModifier()->getListDirection(node->uiNodeHandle);
5654     g_numberValues[0].i32 = value;
5655     return &g_attributeItem;
5656 }
5657 
SetListDirection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5658 int32_t SetListDirection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5659 {
5660     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5661     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
5662         return ERROR_CODE_PARAM_INVALID;
5663     }
5664     auto fullImpl = GetFullImpl();
5665     auto attrVal = item->value[0].i32;
5666     fullImpl->getNodeModifiers()->getListModifier()->setListDirection(node->uiNodeHandle, attrVal);
5667     return ERROR_CODE_NO_ERROR;
5668 }
5669 
ResetListDirection(ArkUI_NodeHandle node)5670 void ResetListDirection(ArkUI_NodeHandle node)
5671 {
5672     // already check in entry point.
5673     auto* fullImpl = GetFullImpl();
5674 
5675     fullImpl->getNodeModifiers()->getListModifier()->resetListDirection(node->uiNodeHandle);
5676 }
5677 
GetListSticky(ArkUI_NodeHandle node)5678 const ArkUI_AttributeItem* GetListSticky(ArkUI_NodeHandle node)
5679 {
5680     auto value = GetFullImpl()->getNodeModifiers()->getListModifier()->getSticky(node->uiNodeHandle);
5681     g_numberValues[0].i32 = value;
5682     return &g_attributeItem;
5683 }
5684 
SetListSticky(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5685 int32_t SetListSticky(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5686 {
5687     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5688     if (actualSize < 0 || !InRegion(NUM_0, NUM_3, item->value[0].i32)) {
5689         return ERROR_CODE_PARAM_INVALID;
5690     }
5691     auto fullImpl = GetFullImpl();
5692     auto attrVal = item->value[0].i32;
5693     fullImpl->getNodeModifiers()->getListModifier()->setSticky(node->uiNodeHandle, attrVal);
5694     return ERROR_CODE_NO_ERROR;
5695 }
5696 
ResetListSticky(ArkUI_NodeHandle node)5697 void ResetListSticky(ArkUI_NodeHandle node)
5698 {
5699     // already check in entry point.
5700     auto* fullImpl = GetFullImpl();
5701 
5702     fullImpl->getNodeModifiers()->getListModifier()->resetSticky(node->uiNodeHandle);
5703 }
5704 
GetListSpace(ArkUI_NodeHandle node)5705 const ArkUI_AttributeItem* GetListSpace(ArkUI_NodeHandle node)
5706 {
5707     auto value = GetFullImpl()->getNodeModifiers()->getListModifier()->getListSpace(node->uiNodeHandle);
5708     g_numberValues[0].f32 = value;
5709     return &g_attributeItem;
5710 }
5711 
SetListSpace(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5712 int32_t SetListSpace(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5713 {
5714     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5715     if (actualSize < 0 || LessNotEqual(item->value[0].i32, NUM_0)) {
5716         return ERROR_CODE_PARAM_INVALID;
5717     }
5718     auto fullImpl = GetFullImpl();
5719 
5720     fullImpl->getNodeModifiers()->getListModifier()->setListSpace(node->uiNodeHandle, item->value[NUM_0].f32);
5721     return ERROR_CODE_NO_ERROR;
5722 }
5723 
ResetListSpace(ArkUI_NodeHandle node)5724 void ResetListSpace(ArkUI_NodeHandle node)
5725 {
5726     // already check in entry point.
5727     auto* fullImpl = GetFullImpl();
5728 
5729     fullImpl->getNodeModifiers()->getListModifier()->resetListSpace(node->uiNodeHandle);
5730 }
5731 
SetListNodeAdapter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5732 int32_t SetListNodeAdapter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5733 {
5734     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5735     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
5736     auto* nodeAdapter = reinterpret_cast<ArkUINodeAdapterHandle>(item->object);
5737     return GetFullImpl()->getNodeModifiers()->getListModifier()->setNodeAdapter(node->uiNodeHandle, nodeAdapter);
5738 }
5739 
ResetListNodeAdapter(ArkUI_NodeHandle node)5740 void ResetListNodeAdapter(ArkUI_NodeHandle node)
5741 {
5742     // already check in entry point.
5743     auto* fullImpl = GetFullImpl();
5744 
5745     fullImpl->getNodeModifiers()->getListModifier()->resetNodeAdapter(node->uiNodeHandle);
5746 }
5747 
GetListNodeAdapter(ArkUI_NodeHandle node)5748 const ArkUI_AttributeItem* GetListNodeAdapter(ArkUI_NodeHandle node)
5749 {
5750     ArkUINodeAdapterHandle adapter =
5751         GetFullImpl()->getNodeModifiers()->getListModifier()->getNodeAdapter(node->uiNodeHandle);
5752     g_attributeItem.object = reinterpret_cast<void*>(adapter);
5753     return &g_attributeItem;
5754 }
5755 
SetListCachedCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5756 int32_t SetListCachedCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5757 {
5758     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5759     if (item->size != 1) {
5760         return ERROR_CODE_PARAM_INVALID;
5761     }
5762     if (LessNotEqual(item->value[0].i32, NUM_0)) {
5763         return ERROR_CODE_PARAM_INVALID;
5764     }
5765     GetFullImpl()->getNodeModifiers()->getListModifier()->setCachedCount(node->uiNodeHandle, item->value[0].i32);
5766     return ERROR_CODE_NO_ERROR;
5767 }
5768 
ResetListCachedCount(ArkUI_NodeHandle node)5769 void ResetListCachedCount(ArkUI_NodeHandle node)
5770 {
5771     // already check in entry point.
5772     auto* fullImpl = GetFullImpl();
5773 
5774     fullImpl->getNodeModifiers()->getListModifier()->resetCachedCount(node->uiNodeHandle);
5775 }
5776 
GetListCachedCount(ArkUI_NodeHandle node)5777 const ArkUI_AttributeItem* GetListCachedCount(ArkUI_NodeHandle node)
5778 {
5779     ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getListModifier()->getCachedCount(node->uiNodeHandle);
5780     g_numberValues[0].i32 = value;
5781     return &g_attributeItem;
5782 }
5783 
SetListAlignListItem(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5784 int32_t SetListAlignListItem(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5785 {
5786     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5787     if (item->size != 1 || !CheckAttributeIsListItemAlign(item->value[0].i32)) {
5788         return ERROR_CODE_PARAM_INVALID;
5789     }
5790     GetFullImpl()->getNodeModifiers()->getListModifier()->setAlignListItem(node->uiNodeHandle, item->value[0].i32);
5791     return ERROR_CODE_NO_ERROR;
5792 }
5793 
ResetListAlignListItem(ArkUI_NodeHandle node)5794 void ResetListAlignListItem(ArkUI_NodeHandle node)
5795 {
5796     auto* fullImpl = GetFullImpl();
5797     fullImpl->getNodeModifiers()->getListModifier()->resetAlignListItem(node->uiNodeHandle);
5798 }
5799 
GetListAlignListItem(ArkUI_NodeHandle node)5800 const ArkUI_AttributeItem* GetListAlignListItem(ArkUI_NodeHandle node)
5801 {
5802     ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getListModifier()->getAlignListItem(node->uiNodeHandle);
5803     g_numberValues[0].i32 = value;
5804     return &g_attributeItem;
5805 }
5806 
SetListChildrenMainSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5807 int32_t SetListChildrenMainSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5808 {
5809     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5810     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
5811     auto* listChildrenMainSize = reinterpret_cast<ArkUIListChildrenMainSize>(item->object);
5812     int32_t unit = GetDefaultUnit(node, UNIT_VP);
5813     GetFullImpl()->getNodeModifiers()->getListModifier()->setListChildrenMainSize(
5814         node->uiNodeHandle, listChildrenMainSize, unit);
5815     return ERROR_CODE_NO_ERROR;
5816 }
5817 
ResetListChildrenMainSize(ArkUI_NodeHandle node)5818 void ResetListChildrenMainSize(ArkUI_NodeHandle node)
5819 {
5820     auto* fullImpl = GetFullImpl();
5821     fullImpl->getNodeModifiers()->getListModifier()->resetListChildrenMainSize(node->uiNodeHandle);
5822 }
5823 
SetListScrollToIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5824 int32_t SetListScrollToIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5825 {
5826     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5827     if (actualSize < NUM_0) {
5828         return ERROR_CODE_PARAM_INVALID;
5829     }
5830     ArkUI_Int32 values[ALLOW_SIZE_3] = { NUM_0, DEFAULT_FALSE, ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_NONE };
5831     values[NUM_0] = item->value[NUM_0].i32;
5832     if (item->size > NUM_1 && InRegion(NUM_0, NUM_1, item->value[NUM_1].i32)) {
5833         values[NUM_1] = item->value[NUM_1].i32;
5834     }
5835     if (item->size > NUM_2 && InRegion(NUM_0, NUM_3, item->value[NUM_2].i32)) {
5836         values[NUM_2] = item->value[NUM_2].i32;
5837     }
5838     if (values[NUM_2] == ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_NONE) {
5839         values[NUM_2] = ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_START;
5840     }
5841     auto* fullImpl = GetFullImpl();
5842     fullImpl->getNodeModifiers()->getListModifier()->setScrollToIndex(
5843         node->uiNodeHandle, values[NUM_0], values[NUM_1], values[NUM_2]);
5844     return ERROR_CODE_NO_ERROR;
5845 }
5846 
SetListInitialIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5847 int32_t SetListInitialIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5848 {
5849     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5850     if (item->size != 1) {
5851         return ERROR_CODE_PARAM_INVALID;
5852     }
5853     if (item->value[0].i32 < 0) {
5854         return ERROR_CODE_PARAM_INVALID;
5855     }
5856     GetFullImpl()->getNodeModifiers()->getListModifier()->setInitialIndex(node->uiNodeHandle, item->value[0].i32);
5857     return ERROR_CODE_NO_ERROR;
5858 }
5859 
ResetListInitialIndex(ArkUI_NodeHandle node)5860 void ResetListInitialIndex(ArkUI_NodeHandle node)
5861 {
5862     // already check in entry point.
5863     auto* fullImpl = GetFullImpl();
5864 
5865     fullImpl->getNodeModifiers()->getListModifier()->resetInitialIndex(node->uiNodeHandle);
5866 }
5867 
GetListInitialIndex(ArkUI_NodeHandle node)5868 const ArkUI_AttributeItem* GetListInitialIndex(ArkUI_NodeHandle node)
5869 {
5870     ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getListModifier()->getInitialIndex(node->uiNodeHandle);
5871     g_numberValues[0].i32 = value;
5872     return &g_attributeItem;
5873 }
5874 
SetListDivider(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5875 int32_t SetListDivider(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5876 {
5877     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
5878     if (actualSize < 0 || LessNotEqual(item->value[NUM_1].f32, NUM_0) ||
5879         LessNotEqual(item->value[NUM_2].f32, NUM_0) || LessNotEqual(item->value[NUM_3].f32, NUM_0)) {
5880         return ERROR_CODE_PARAM_INVALID;
5881     }
5882     auto fullImpl = GetFullImpl();
5883     auto color = item->value[NUM_0].u32;
5884     int32_t unit = GetDefaultUnit(node, UNIT_VP);
5885     ArkUI_Float32 values[NUM_3] = { item->value[NUM_1].f32, item->value[NUM_2].f32, item->value[NUM_3].f32 };
5886     ArkUI_Int32 units[NUM_3] = { unit, unit, unit };
5887 
5888     fullImpl->getNodeModifiers()->getListModifier()->listSetDivider(node->uiNodeHandle, color, values, units, NUM_3);
5889     return ERROR_CODE_NO_ERROR;
5890 }
5891 
ResetListDivider(ArkUI_NodeHandle node)5892 void ResetListDivider(ArkUI_NodeHandle node)
5893 {
5894     // already check in entry point.
5895     auto* fullImpl = GetFullImpl();
5896     fullImpl->getNodeModifiers()->getListModifier()->listResetDivider(node->uiNodeHandle);
5897 }
5898 
GetListDivider(ArkUI_NodeHandle node)5899 const ArkUI_AttributeItem* GetListDivider(ArkUI_NodeHandle node)
5900 {
5901     ArkUIdividerOptions option;
5902     GetFullImpl()->getNodeModifiers()->getListModifier()->getlistDivider(
5903         node->uiNodeHandle, &option, GetDefaultUnit(node, UNIT_VP));
5904     //size index
5905     g_numberValues[NUM_0].u32 = option.color;
5906     g_numberValues[NUM_1].f32 = option.strokeWidth;
5907     g_numberValues[NUM_2].f32 = option.startMargin;
5908     g_numberValues[NUM_3].f32 = option.endMargin;
5909     g_attributeItem.size = ALLOW_SIZE_4;
5910     return &g_attributeItem;
5911 }
5912 
5913 // TextArea
SetTextAreaPlaceholderFont(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5914 int32_t SetTextAreaPlaceholderFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5915 {
5916     if (item == nullptr) {
5917         return ERROR_CODE_PARAM_INVALID;
5918     }
5919     auto* fullImpl = GetFullImpl();
5920     struct ArkUIResourceLength size = { 16.0, GetDefaultUnit(node, UNIT_FP) };
5921     int weight = ARKUI_FONT_WEIGHT_NORMAL;
5922     int style = ARKUI_FONT_STYLE_NORMAL;
5923     if (item->size > NUM_0) {
5924         if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
5925             return ERROR_CODE_PARAM_INVALID;
5926         }
5927         size.value = item->value[NUM_0].f32;
5928     }
5929     if (item->size > NUM_1) {
5930         if (item->value[NUM_1].i32 < 0 || item->value[NUM_1].i32 > static_cast<int32_t>(ARKUI_FONT_STYLE_ITALIC)) {
5931             return ERROR_CODE_PARAM_INVALID;
5932         }
5933         style = item->value[NUM_1].i32;
5934     }
5935     if (item->size > NUM_2) {
5936         if (item->value[NUM_2].i32 < 0 || item->value[NUM_2].i32 > static_cast<int32_t>(ARKUI_FONT_WEIGHT_REGULAR)) {
5937             return ERROR_CODE_PARAM_INVALID;
5938         }
5939         weight = item->value[NUM_2].i32;
5940     }
5941     fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPlaceholderFontEnum(
5942         node->uiNodeHandle, &size, weight, item->string, style);
5943     return ERROR_CODE_NO_ERROR;
5944 }
5945 
GetTextAreaPlaceholderFont(ArkUI_NodeHandle node)5946 const ArkUI_AttributeItem* GetTextAreaPlaceholderFont(ArkUI_NodeHandle node)
5947 {
5948     ArkUITextFont font;
5949     font.fontSizeUnit = GetDefaultUnit(node, UNIT_FP);
5950     GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaPlaceholderFont(
5951         node->uiNodeHandle, &font);
5952     int index = 0;
5953     g_numberValues[index++].f32 = font.fontSize;
5954     g_numberValues[index++].i32 = font.fontStyle;
5955     g_numberValues[index++].i32 = font.fontWeight;
5956     g_attributeItem.size = index;
5957     g_attributeItem.string = font.fontFamilies;
5958     return &g_attributeItem;
5959 }
5960 
ResetTextAreaPlaceholderFont(ArkUI_NodeHandle node)5961 void ResetTextAreaPlaceholderFont(ArkUI_NodeHandle node)
5962 {
5963     auto* fullImpl = GetFullImpl();
5964     fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaPlaceholderFont(node->uiNodeHandle);
5965 }
5966 
SetTextAreaPlaceholder(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5967 int32_t SetTextAreaPlaceholder(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5968 {
5969     // already check in entry point.
5970     auto* fullImpl = GetFullImpl();
5971     ArkUI_CharPtr itemString = item->string;
5972     if (!itemString) {
5973         itemString = "";
5974     }
5975     fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPlaceholderString(
5976         node->uiNodeHandle, itemString);
5977     return ERROR_CODE_NO_ERROR;
5978 }
5979 
GetTextAreaPlaceholder(ArkUI_NodeHandle node)5980 const ArkUI_AttributeItem* GetTextAreaPlaceholder(ArkUI_NodeHandle node)
5981 {
5982     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaPlaceholder(
5983         node->uiNodeHandle);
5984     g_attributeItem.string = resultValue;
5985     return &g_attributeItem;
5986 }
5987 
ResetTextAreaPlaceholder(ArkUI_NodeHandle node)5988 void ResetTextAreaPlaceholder(ArkUI_NodeHandle node)
5989 {
5990     auto* fullImpl = GetFullImpl();
5991     fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPlaceholderString(node->uiNodeHandle, "");
5992 }
5993 
SetTextAreaText(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5994 int32_t SetTextAreaText(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5995 {
5996     // already check in entry point.
5997     auto* fullImpl = GetFullImpl();
5998     ArkUI_CharPtr itemString = item->string;
5999     if (!itemString) {
6000         itemString = "";
6001     }
6002     fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaTextString(
6003         node->uiNodeHandle, itemString);
6004     return ERROR_CODE_NO_ERROR;
6005 }
6006 
GetTextAreaText(ArkUI_NodeHandle node)6007 const ArkUI_AttributeItem* GetTextAreaText(ArkUI_NodeHandle node)
6008 {
6009     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaText(
6010         node->uiNodeHandle);
6011     g_attributeItem.string = resultValue;
6012     return &g_attributeItem;
6013 }
6014 
ResetTextAreaText(ArkUI_NodeHandle node)6015 void ResetTextAreaText(ArkUI_NodeHandle node)
6016 {
6017     auto* fullImpl = GetFullImpl();
6018     fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaTextString(node->uiNodeHandle, "");
6019 }
6020 
StopTextAreaEditing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6021 int32_t StopTextAreaEditing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6022 {
6023     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6024     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
6025         return ERROR_CODE_PARAM_INVALID;
6026     }
6027     // already check in entry point.
6028     auto* fullImpl = GetFullImpl();
6029     if (item->value[NUM_0].i32 == 0) {
6030         fullImpl->getNodeModifiers()->getTextAreaModifier()->stopTextAreaTextEditing(node->uiNodeHandle);
6031     }
6032     return ERROR_CODE_NO_ERROR;
6033 }
6034 
GetTextAreaEditing(ArkUI_NodeHandle node)6035 const ArkUI_AttributeItem* GetTextAreaEditing(ArkUI_NodeHandle node)
6036 {
6037     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaEditing(
6038         node->uiNodeHandle);
6039     g_numberValues[0].i32 = resultValue;
6040     return &g_attributeItem;
6041 }
6042 
SetTextAreaType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6043 int32_t SetTextAreaType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6044 {
6045     // already check in entry point.
6046     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6047     if (actualSize < 0 || !InRegion(NUM_0, NUM_5, item->value[0].i32)) {
6048         return ERROR_CODE_PARAM_INVALID;
6049     }
6050     auto* fullImpl = GetFullImpl();
6051     fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaType(node->uiNodeHandle, item->value[0].i32);
6052     return ERROR_CODE_NO_ERROR;
6053 }
6054 
GetTextAreaType(ArkUI_NodeHandle node)6055 const ArkUI_AttributeItem* GetTextAreaType(ArkUI_NodeHandle node)
6056 {
6057     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaType(
6058         node->uiNodeHandle);
6059     g_numberValues[0].i32 = resultValue;
6060     return &g_attributeItem;
6061 }
6062 
ResetTextAreaType(ArkUI_NodeHandle node)6063 void ResetTextAreaType(ArkUI_NodeHandle node)
6064 {
6065     auto* fullImpl = GetFullImpl();
6066     fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaType(node->uiNodeHandle);
6067 }
6068 
SetTextAreaShowCounter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6069 int32_t SetTextAreaShowCounter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6070 {
6071     if (item->size == 0) {
6072         return ERROR_CODE_PARAM_INVALID;
6073     }
6074     auto* fullImpl = GetFullImpl();
6075     ArkUI_Bool open = false;
6076     ArkUI_Int32 thresholdPercentage = -1;
6077     ArkUI_Bool highlightBorder = true;
6078     if (item->size > NUM_0) {
6079         if (!InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
6080             return ERROR_CODE_PARAM_INVALID;
6081         }
6082         open = item->value[NUM_0].i32;
6083     }
6084     if (item->size > NUM_1) {
6085         if (!InRegion(NUM_1, NUM_100, static_cast<ArkUI_Int32>(item->value[NUM_1].f32))) {
6086             return ERROR_CODE_PARAM_INVALID;
6087         }
6088         thresholdPercentage = static_cast<ArkUI_Int32>(item->value[NUM_1].f32);
6089     }
6090     if (item->size > NUM_2) {
6091         if (!InRegion(NUM_0, NUM_1, item->value[NUM_2].i32)) {
6092             return ERROR_CODE_PARAM_INVALID;
6093         }
6094         highlightBorder = item->value[NUM_2].i32;
6095     }
6096 
6097     fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaShowCounterOptions(
6098         node->uiNodeHandle, open, thresholdPercentage, highlightBorder);
6099     return ERROR_CODE_NO_ERROR;
6100 }
6101 
ResetTextAreaShowCounter(ArkUI_NodeHandle node)6102 void ResetTextAreaShowCounter(ArkUI_NodeHandle node)
6103 {
6104     auto* fullImpl = GetFullImpl();
6105     fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaShowCounterOptions(node->uiNodeHandle);
6106 }
6107 
GetTextAreaShowCounter(ArkUI_NodeHandle node)6108 const ArkUI_AttributeItem* GetTextAreaShowCounter(ArkUI_NodeHandle node)
6109 {
6110     ArkUIShowCountOptions options;
6111     auto modifier = GetFullImpl()->getNodeModifiers()->getTextAreaModifier();
6112     modifier->getTextAreaShowCounterOptions(node->uiNodeHandle, &options);
6113     // open
6114     g_numberValues[NUM_0].i32 = options.open;
6115     // thresholdPercentage
6116     g_numberValues[NUM_1].f32 = options.thresholdPercentage;
6117     // highlightBorder
6118     g_numberValues[NUM_2].i32 = options.highlightBorder;
6119     return &g_attributeItem;
6120 }
6121 
SetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6122 int32_t SetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6123 {
6124     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
6125         return ERROR_CODE_PARAM_INVALID;
6126     }
6127     auto* fullImpl = GetFullImpl();
6128     fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaSelectionMenuHidden(
6129         node->uiNodeHandle, item->value[NUM_0].i32);
6130     return ERROR_CODE_NO_ERROR;
6131 }
6132 
GetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node)6133 const ArkUI_AttributeItem* GetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node)
6134 {
6135     g_numberValues[0].i32 =
6136         GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaSelectionMenuHidden(node->uiNodeHandle);
6137     return &g_attributeItem;
6138 }
6139 
ResetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node)6140 void ResetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node)
6141 {
6142     auto* fullImpl = GetFullImpl();
6143     fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaSelectionMenuHidden(node->uiNodeHandle);
6144 }
6145 
6146 // button
SetButtonLabel(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6147 int32_t SetButtonLabel(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6148 {
6149     if (item == nullptr || item->string == nullptr) {
6150         return ERROR_CODE_PARAM_INVALID;
6151     }
6152     auto* fullImpl = GetFullImpl();
6153     fullImpl->getNodeModifiers()->getButtonModifier()->setButtonLabel(node->uiNodeHandle, item->string);
6154     return ERROR_CODE_NO_ERROR;
6155 }
6156 
GetButtonLabel(ArkUI_NodeHandle node)6157 const ArkUI_AttributeItem* GetButtonLabel(ArkUI_NodeHandle node)
6158 {
6159     auto resultValue = GetFullImpl()->getNodeModifiers()->getButtonModifier()->getButtonLabel(
6160         node->uiNodeHandle);
6161     g_attributeItem.string = resultValue;
6162     return &g_attributeItem;
6163 }
6164 
ResetButtonLabel(ArkUI_NodeHandle node)6165 void ResetButtonLabel(ArkUI_NodeHandle node)
6166 {
6167     auto* fullImpl = GetFullImpl();
6168     fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonLabel(node->uiNodeHandle);
6169 }
6170 
SetButtonType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6171 int32_t SetButtonType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6172 {
6173     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6174     if (LessNotEqual(actualSize, 0) ||
6175         !InRegion(ARKUI_BUTTON_TYPE_NORMAL, ARKUI_BUTTON_TYPE_CIRCLE, item->value[NUM_0].i32)) {
6176         return ERROR_CODE_PARAM_INVALID;
6177     }
6178 
6179     auto* fullImpl = GetFullImpl();
6180     fullImpl->getNodeModifiers()->getButtonModifier()->setButtonType(node->uiNodeHandle, item->value[NUM_0].i32);
6181     return ERROR_CODE_NO_ERROR;
6182 }
6183 
GetButtonType(ArkUI_NodeHandle node)6184 const ArkUI_AttributeItem* GetButtonType(ArkUI_NodeHandle node)
6185 {
6186     auto resultValue = GetFullImpl()->getNodeModifiers()->getButtonModifier()->getButtonType(node->uiNodeHandle);
6187     g_numberValues[0].i32 = resultValue;
6188     return &g_attributeItem;
6189 }
6190 
ResetButtonType(ArkUI_NodeHandle node)6191 void ResetButtonType(ArkUI_NodeHandle node)
6192 {
6193     auto* fullImpl = GetFullImpl();
6194     fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonType(node->uiNodeHandle);
6195 }
6196 
SetProgressValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6197 int32_t SetProgressValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6198 {
6199     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6200     if (actualSize < 0 || LessNotEqual(item->value[0].f32, 0.0f)) {
6201         return ERROR_CODE_PARAM_INVALID;
6202     }
6203     auto* fullImpl = GetFullImpl();
6204     fullImpl->getNodeModifiers()->getProgressModifier()->setProgressValue(node->uiNodeHandle, item->value[0].f32);
6205     return ERROR_CODE_NO_ERROR;
6206 }
6207 
GetProgressValue(ArkUI_NodeHandle node)6208 const ArkUI_AttributeItem* GetProgressValue(ArkUI_NodeHandle node)
6209 {
6210     auto resultValue = GetFullImpl()->getNodeModifiers()->getProgressModifier()->getProgressValue(
6211         node->uiNodeHandle);
6212     g_numberValues[0].f32 = resultValue;
6213     return &g_attributeItem;
6214 }
6215 
ResetProgressValue(ArkUI_NodeHandle node)6216 void ResetProgressValue(ArkUI_NodeHandle node)
6217 {
6218     auto* fullImpl = GetFullImpl();
6219     fullImpl->getNodeModifiers()->getProgressModifier()->resetProgressValue(node->uiNodeHandle);
6220 }
6221 
SetProgressTotal(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6222 int32_t SetProgressTotal(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6223 {
6224     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6225     if (actualSize < 0 || LessNotEqual(item->value[0].f32, 0.0f)) {
6226         return ERROR_CODE_PARAM_INVALID;
6227     }
6228     auto* fullImpl = GetFullImpl();
6229     fullImpl->getNodeModifiers()->getProgressModifier()->setProgressTotal(node->uiNodeHandle, item->value[0].f32);
6230     return ERROR_CODE_NO_ERROR;
6231 }
6232 
GetProgressTotal(ArkUI_NodeHandle node)6233 const ArkUI_AttributeItem* GetProgressTotal(ArkUI_NodeHandle node)
6234 {
6235     auto resultValue = GetFullImpl()->getNodeModifiers()->getProgressModifier()->getProgressTotal(
6236         node->uiNodeHandle);
6237     g_numberValues[0].f32 = resultValue;
6238     return &g_attributeItem;
6239 }
6240 
ResetProgressTotal(ArkUI_NodeHandle node)6241 void ResetProgressTotal(ArkUI_NodeHandle node)
6242 {
6243     auto* fullImpl = GetFullImpl();
6244     fullImpl->getNodeModifiers()->getProgressModifier()->resetProgressValue(node->uiNodeHandle);
6245 }
6246 
SetProgressColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6247 int32_t SetProgressColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6248 {
6249     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6250     if (actualSize < 0) {
6251         return ERROR_CODE_PARAM_INVALID;
6252     }
6253     auto* fullImpl = GetFullImpl();
6254     fullImpl->getNodeModifiers()->getProgressModifier()->setProgressColor(node->uiNodeHandle, item->value[0].u32);
6255     return ERROR_CODE_NO_ERROR;
6256 }
6257 
GetProgressColor(ArkUI_NodeHandle node)6258 const ArkUI_AttributeItem* GetProgressColor(ArkUI_NodeHandle node)
6259 {
6260     auto resultValue = GetFullImpl()->getNodeModifiers()->getProgressModifier()->getProgressColor(
6261         node->uiNodeHandle);
6262     g_numberValues[0].u32 = resultValue;
6263     return &g_attributeItem;
6264 }
6265 
ResetProgressColor(ArkUI_NodeHandle node)6266 void ResetProgressColor(ArkUI_NodeHandle node)
6267 {
6268     auto* fullImpl = GetFullImpl();
6269     fullImpl->getNodeModifiers()->getProgressModifier()->resetProgressColor(node->uiNodeHandle);
6270 }
6271 
SetProgressType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6272 int32_t SetProgressType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6273 {
6274     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6275     if (actualSize < 0 || !InRegion(static_cast<int32_t>(ARKUI_PROGRESS_TYPE_LINEAR),
6276         static_cast<int32_t>(ARKUI_PROGRESS_TYPE_CAPSULE), item->value[NUM_0].i32)) {
6277         return ERROR_CODE_PARAM_INVALID;
6278     }
6279     auto* fullImpl = GetFullImpl();
6280     fullImpl->getNodeModifiers()->getProgressModifier()->setProgressType(node->uiNodeHandle,
6281         PROGRESS_TYPE_ARRAY[item->value[NUM_0].i32]);
6282     return ERROR_CODE_NO_ERROR;
6283 }
6284 
GetProgressType(ArkUI_NodeHandle node)6285 const ArkUI_AttributeItem* GetProgressType(ArkUI_NodeHandle node)
6286 {
6287     auto resultValue = GetFullImpl()->getNodeModifiers()->getProgressModifier()->getProgressType(
6288         node->uiNodeHandle);
6289     auto it = std::find(PROGRESS_TYPE_ARRAY.begin(), PROGRESS_TYPE_ARRAY.end(), resultValue);
6290     if (it != PROGRESS_TYPE_ARRAY.end()) {
6291         g_numberValues[0].i32 = std::distance(PROGRESS_TYPE_ARRAY.begin(), it);
6292     }
6293     return &g_attributeItem;
6294 }
6295 
ResetProgressType(ArkUI_NodeHandle node)6296 void ResetProgressType(ArkUI_NodeHandle node)
6297 {
6298     auto* fullImpl = GetFullImpl();
6299     fullImpl->getNodeModifiers()->getProgressModifier()->resetProgressType(node->uiNodeHandle);
6300 }
6301 
SetXComponentId(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6302 int32_t SetXComponentId(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6303 {
6304     // already check in entry point.
6305     auto* fullImpl = GetFullImpl();
6306     if (item == nullptr || !item->string) {
6307         return ERROR_CODE_PARAM_INVALID;
6308     }
6309     fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentId(node->uiNodeHandle, item->string);
6310     return ERROR_CODE_NO_ERROR;
6311 }
6312 
GetXComponentId(ArkUI_NodeHandle node)6313 const ArkUI_AttributeItem* GetXComponentId(ArkUI_NodeHandle node)
6314 {
6315     auto resultValue = GetFullImpl()->getNodeModifiers()->getXComponentModifier()->getXComponentId(
6316         node->uiNodeHandle);
6317     g_attributeItem.string = resultValue;
6318     return &g_attributeItem;
6319 }
6320 
SetXComponentType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6321 int32_t SetXComponentType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6322 {
6323     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6324     if (actualSize < 0 || (item->value[NUM_0].i32 != static_cast<int32_t>(ARKUI_XCOMPONENT_TYPE_SURFACE) &&
6325         item->value[NUM_0].i32 != static_cast<int32_t>(ARKUI_XCOMPONENT_TYPE_TEXTURE))) {
6326         return ERROR_CODE_PARAM_INVALID;
6327     }
6328     // already check in entry point.
6329     auto* fullImpl = GetFullImpl();
6330     fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentType(
6331         node->uiNodeHandle, item->value[NUM_0].i32);
6332     return ERROR_CODE_NO_ERROR;
6333 }
6334 
GetXComponentType(ArkUI_NodeHandle node)6335 const ArkUI_AttributeItem* GetXComponentType(ArkUI_NodeHandle node)
6336 {
6337     auto resultValue = GetFullImpl()->getNodeModifiers()->getXComponentModifier()->getXComponentType(
6338         node->uiNodeHandle);
6339     g_numberValues[0].i32 = resultValue;
6340     return &g_attributeItem;
6341 }
6342 
ResetXComponentType(ArkUI_NodeHandle node)6343 void ResetXComponentType(ArkUI_NodeHandle node)
6344 {
6345     auto* fullImpl = GetFullImpl();
6346     fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentType(
6347         node->uiNodeHandle, ARKUI_XCOMPONENT_TYPE_SURFACE);
6348 }
6349 
SetXComponentSurfaceSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6350 int32_t SetXComponentSurfaceSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6351 {
6352     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
6353     if (actualSize < 0) {
6354         return ERROR_CODE_PARAM_INVALID;
6355     }
6356     // already check in entry point.
6357     auto* fullImpl = GetFullImpl();
6358     fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentSurfaceSize(
6359         node->uiNodeHandle, item->value[0].u32, item->value[1].u32);
6360     return ERROR_CODE_NO_ERROR;
6361 }
6362 
GetXComponentSurfaceSize(ArkUI_NodeHandle node)6363 const ArkUI_AttributeItem* GetXComponentSurfaceSize(ArkUI_NodeHandle node)
6364 {
6365     int index = 0;
6366     g_numberValues[index++].u32 =
6367         GetFullImpl()->getNodeModifiers()->getXComponentModifier()->getXComponentSurfaceWidth(node->uiNodeHandle);
6368     g_numberValues[index++].u32 =
6369         GetFullImpl()->getNodeModifiers()->getXComponentModifier()->getXComponentSurfaceHeight(node->uiNodeHandle);
6370     g_attributeItem.size = index;
6371     return &g_attributeItem;
6372 }
6373 
ResetXComponentSurfaceSize(ArkUI_NodeHandle node)6374 void ResetXComponentSurfaceSize(ArkUI_NodeHandle node)
6375 {
6376     auto* fullImpl = GetFullImpl();
6377     fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentSurfaceSize(node->uiNodeHandle, 0, 0);
6378 }
6379 
SetBaseLineOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6380 int32_t SetBaseLineOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6381 {
6382     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6383     if (actualSize < 0) {
6384         return ERROR_CODE_PARAM_INVALID;
6385     }
6386     // already check in entry point.
6387     auto* fullImpl = GetFullImpl();
6388     if (node->type == ARKUI_NODE_SPAN) {
6389         fullImpl->getNodeModifiers()->getSpanModifier()->setSpanBaselineOffset(node->uiNodeHandle,
6390             item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6391     } else {
6392         fullImpl->getNodeModifiers()->getTextModifier()->setTextBaselineOffset(node->uiNodeHandle,
6393             item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6394     }
6395     return ERROR_CODE_NO_ERROR;
6396 }
6397 
ResetBaselineOffset(ArkUI_NodeHandle node)6398 void ResetBaselineOffset(ArkUI_NodeHandle node)
6399 {
6400     auto* fullImpl = GetFullImpl();
6401     if (node->type == ARKUI_NODE_SPAN) {
6402         fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanBaselineOffset(node->uiNodeHandle);
6403     } else {
6404         fullImpl->getNodeModifiers()->getTextModifier()->resetTextBaselineOffset(node->uiNodeHandle);
6405     }
6406 }
6407 
SetTextShadow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6408 int32_t SetTextShadow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6409 {
6410     if (item->size < NUM_5) {
6411         return ERROR_CODE_PARAM_INVALID;
6412     }
6413     // already check in entry point.
6414     auto* fullImpl = GetFullImpl();
6415 
6416     std::vector<struct ArkUITextShadowStruct> shadows;
6417     struct ArkUITextShadowStruct shadow = { item->value[0].f32, item->value[1].i32, item->value[2].u32,
6418         item->value[3].f32, item->value[4].f32 };
6419     shadows.emplace_back(shadow);
6420     if (node->type == ARKUI_NODE_TEXT) {
6421         fullImpl->getNodeModifiers()->getTextModifier()->setTextShadow(node->uiNodeHandle, &shadows[0], shadows.size());
6422     } else if (node->type == ARKUI_NODE_SPAN) {
6423         fullImpl->getNodeModifiers()->getSpanModifier()->setTextShadow(node->uiNodeHandle, &shadows[0], shadows.size());
6424     }
6425     return ERROR_CODE_NO_ERROR;
6426 }
6427 
ResetTextShadow(ArkUI_NodeHandle node)6428 void ResetTextShadow(ArkUI_NodeHandle node)
6429 {
6430     auto* fullImpl = GetFullImpl();
6431     if (node->type == ARKUI_NODE_TEXT) {
6432         fullImpl->getNodeModifiers()->getTextModifier()->resetTextShadow(node->uiNodeHandle);
6433     } else if (node->type == ARKUI_NODE_SPAN) {
6434         fullImpl->getNodeModifiers()->getSpanModifier()->resetTextShadow(node->uiNodeHandle);
6435     }
6436 }
6437 
SetTextMinFontSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6438 int32_t SetTextMinFontSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6439 {
6440     if (item->size == 0) {
6441         return ERROR_CODE_PARAM_INVALID;
6442     }
6443     auto fullImpl = GetFullImpl();
6444     if (node->type == ARKUI_NODE_TEXT) {
6445         fullImpl->getNodeModifiers()->getTextModifier()->setTextMinFontSize(
6446             node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6447     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6448         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputAdaptMinFontSize(
6449             node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6450     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6451         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaAdaptMinFontSize(
6452             node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6453     }
6454     return ERROR_CODE_NO_ERROR;
6455 }
6456 
GetTextMinFontSize(ArkUI_NodeHandle node)6457 const ArkUI_AttributeItem* GetTextMinFontSize(ArkUI_NodeHandle node)
6458 {
6459     if (node->type == ARKUI_NODE_TEXT) {
6460         g_numberValues[0].f32 =
6461             GetFullImpl()->getNodeModifiers()->getTextModifier()->getTextMinFontSize(node->uiNodeHandle);
6462     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6463         g_numberValues[0].f32 =
6464             GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputAdaptMinFontSize(node->uiNodeHandle);
6465     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6466         g_numberValues[0].f32 =
6467             GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaAdaptMinFontSize(node->uiNodeHandle);
6468     }
6469     return &g_attributeItem;
6470 }
6471 
ResetTextMinFontSize(ArkUI_NodeHandle node)6472 void ResetTextMinFontSize(ArkUI_NodeHandle node)
6473 {
6474     auto fullImpl = GetFullImpl();
6475     if (node->type == ARKUI_NODE_TEXT) {
6476         fullImpl->getNodeModifiers()->getTextModifier()->resetTextMinFontSize(node->uiNodeHandle);
6477     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6478         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputAdaptMinFontSize(node->uiNodeHandle);
6479     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6480         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaAdaptMinFontSize(node->uiNodeHandle);
6481     }
6482 }
6483 
SetTextMaxFontSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6484 int32_t SetTextMaxFontSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6485 {
6486     if (item->size == 0) {
6487         return ERROR_CODE_PARAM_INVALID;
6488     }
6489     auto fullImpl = GetFullImpl();
6490     if (node->type == ARKUI_NODE_TEXT) {
6491         fullImpl->getNodeModifiers()->getTextModifier()->setTextMaxFontSize(
6492             node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6493     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6494         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputAdaptMaxFontSize(
6495             node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6496     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6497         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaAdaptMaxFontSize(
6498             node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6499     }
6500     return ERROR_CODE_NO_ERROR;
6501 }
6502 
GetTextMaxFontSize(ArkUI_NodeHandle node)6503 const ArkUI_AttributeItem* GetTextMaxFontSize(ArkUI_NodeHandle node)
6504 {
6505     if (node->type == ARKUI_NODE_TEXT) {
6506         g_numberValues[0].f32 =
6507             GetFullImpl()->getNodeModifiers()->getTextModifier()->getTextMaxFontSize(node->uiNodeHandle);
6508     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6509         g_numberValues[0].f32 =
6510             GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputAdaptMaxFontSize(node->uiNodeHandle);
6511     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6512         g_numberValues[0].f32 =
6513             GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaAdaptMaxFontSize(node->uiNodeHandle);
6514     }
6515     return &g_attributeItem;
6516 }
6517 
ResetTextMaxFontSize(ArkUI_NodeHandle node)6518 void ResetTextMaxFontSize(ArkUI_NodeHandle node)
6519 {
6520     auto fullImpl = GetFullImpl();
6521     if (node->type == ARKUI_NODE_TEXT) {
6522         fullImpl->getNodeModifiers()->getTextModifier()->resetTextMaxFontSize(node->uiNodeHandle);
6523     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6524         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputAdaptMaxFontSize(node->uiNodeHandle);
6525     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6526         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaAdaptMaxFontSize(node->uiNodeHandle);
6527     }
6528 }
6529 
SetTextFont(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6530 int32_t SetTextFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6531 {
6532     if (item->size == 0) {
6533         return ERROR_CODE_PARAM_INVALID;
6534     }
6535     auto fullImpl = GetFullImpl();
6536     // size
6537     double size = item->value[0].f32;
6538     // weight
6539     int weight = 10; // default
6540     if (item->size > 1) {
6541         if (!CheckAttributeIsFontWeight(item->value[1].i32)) {
6542             return ERROR_CODE_PARAM_INVALID;
6543         }
6544         weight = item->value[1].i32;
6545     }
6546     // style
6547     int style = 0;
6548     if (item->size > 2) {
6549         // get value 2 is font style
6550         if (!CheckAttributeIsFontStyle(item->value[2].i32)) {
6551             return ERROR_CODE_PARAM_INVALID;
6552         }
6553         style = item->value[NUM_2].i32;
6554     }
6555     // family
6556     std::vector<std::string> familyArray;
6557     if (item->string != nullptr) {
6558         std::string value(item->string);
6559         StringUtils::StringSplitter(value, ',', familyArray);
6560     }
6561 
6562     ArkUIFontWithOptionsStruct fontStruct;
6563     fontStruct.fontSizeNumber = size;
6564     fontStruct.fontSizeUnit = GetDefaultUnit(node, UNIT_FP);
6565     fontStruct.fontWeight = weight;
6566     if (familyArray.size() > 0) {
6567         std::vector<const char*> fontFamilies;
6568         for (const auto& element : familyArray) {
6569             fontFamilies.push_back(element.c_str());
6570         }
6571         fontStruct.fontFamilies = fontFamilies.data();
6572     }
6573     fontStruct.fontStyle = style;
6574     ArkUIFontWithOptionsStruct* fontInfo = &fontStruct;
6575     fullImpl->getNodeModifiers()->getTextModifier()->setTextFont(node->uiNodeHandle, fontInfo);
6576     return ERROR_CODE_NO_ERROR;
6577 }
6578 
GetTextFont(ArkUI_NodeHandle node)6579 const ArkUI_AttributeItem* GetTextFont(ArkUI_NodeHandle node)
6580 {
6581     ArkUITextFont font;
6582     font.fontSizeUnit = GetDefaultUnit(node, UNIT_FP);
6583     GetFullImpl()->getNodeModifiers()->getTextModifier()->getFont(node->uiNodeHandle, &font);
6584     int index = 0;
6585     g_numberValues[index++].f32 = font.fontSize;
6586     g_numberValues[index++].i32 = font.fontWeight;
6587     g_numberValues[index++].i32 = font.fontStyle;
6588     g_attributeItem.size = index;
6589     g_attributeItem.string = font.fontFamilies;
6590     return &g_attributeItem;
6591 }
6592 
ResetTextFont(ArkUI_NodeHandle node)6593 void ResetTextFont(ArkUI_NodeHandle node)
6594 {
6595     auto fullImpl = GetFullImpl();
6596     fullImpl->getNodeModifiers()->getTextModifier()->resetTextFont(node->uiNodeHandle);
6597 }
6598 
SetTextHeightAdaptivePolicy(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6599 int32_t SetTextHeightAdaptivePolicy(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6600 {
6601     if (item->size == 0 || !CheckAttributeIsTextHeightAdaptivePolicy(item->value[0].i32)) {
6602         return ERROR_CODE_PARAM_INVALID;
6603     }
6604     auto fullImpl = GetFullImpl();
6605     fullImpl->getNodeModifiers()->getTextModifier()->setTextHeightAdaptivePolicy(
6606         node->uiNodeHandle, item->value[0].i32);
6607     return ERROR_CODE_NO_ERROR;
6608 }
6609 
GetTextHeightAdaptivePolicy(ArkUI_NodeHandle node)6610 const ArkUI_AttributeItem* GetTextHeightAdaptivePolicy(ArkUI_NodeHandle node)
6611 {
6612     auto resultValue =
6613         GetFullImpl()->getNodeModifiers()->getTextModifier()->getHeightAdaptivePolicy(node->uiNodeHandle);
6614     g_numberValues[0].i32 = resultValue;
6615     return &g_attributeItem;
6616 }
6617 
ResetTextHeightAdaptivePolicy(ArkUI_NodeHandle node)6618 void ResetTextHeightAdaptivePolicy(ArkUI_NodeHandle node)
6619 {
6620     auto fullImpl = GetFullImpl();
6621     fullImpl->getNodeModifiers()->getTextModifier()->resetTextHeightAdaptivePolicy(node->uiNodeHandle);
6622 }
6623 
6624 // Toggle Attributes functions
SetToggleSelectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6625 int32_t SetToggleSelectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6626 {
6627     if (item->size == 0) {
6628         return ERROR_CODE_PARAM_INVALID;
6629     }
6630     auto* fullImpl = GetFullImpl();
6631 
6632     fullImpl->getNodeModifiers()->getToggleModifier()->setToggleSelectedColor(node->uiNodeHandle, item->value[0].u32);
6633     return ERROR_CODE_NO_ERROR;
6634 }
6635 
GetToggleSelectedColor(ArkUI_NodeHandle node)6636 const ArkUI_AttributeItem* GetToggleSelectedColor(ArkUI_NodeHandle node)
6637 {
6638     auto resultValue =
6639         GetFullImpl()->getNodeModifiers()->getToggleModifier()->getToggleSelectedColor(node->uiNodeHandle);
6640     g_numberValues[0].u32 = resultValue;
6641     return &g_attributeItem;
6642 }
6643 
ResetToggleSelectedColor(ArkUI_NodeHandle node)6644 void ResetToggleSelectedColor(ArkUI_NodeHandle node)
6645 {
6646     auto* fullImpl = GetFullImpl();
6647 
6648     fullImpl->getNodeModifiers()->getToggleModifier()->resetToggleSelectedColor(node->uiNodeHandle);
6649 }
6650 
SetToggleSwitchPointColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6651 int32_t SetToggleSwitchPointColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6652 {
6653     if (item->size == 0) {
6654         return ERROR_CODE_PARAM_INVALID;
6655     }
6656     auto* fullImpl = GetFullImpl();
6657 
6658     fullImpl->getNodeModifiers()->getToggleModifier()->setToggleSwitchPointColor(
6659         node->uiNodeHandle, item->value[0].u32);
6660     return ERROR_CODE_NO_ERROR;
6661 }
6662 
GetToggleSwitchPointColor(ArkUI_NodeHandle node)6663 const ArkUI_AttributeItem* GetToggleSwitchPointColor(ArkUI_NodeHandle node)
6664 {
6665     auto resultValue =
6666         GetFullImpl()->getNodeModifiers()->getToggleModifier()->getToggleSwitchPointColor(node->uiNodeHandle);
6667     g_numberValues[0].u32 = resultValue;
6668     return &g_attributeItem;
6669 }
6670 
ResetToggleSwitchPointColor(ArkUI_NodeHandle node)6671 void ResetToggleSwitchPointColor(ArkUI_NodeHandle node)
6672 {
6673     auto* fullImpl = GetFullImpl();
6674 
6675     fullImpl->getNodeModifiers()->getToggleModifier()->resetToggleSwitchPointColor(node->uiNodeHandle);
6676 }
6677 
SetToggleValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6678 int32_t SetToggleValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6679 {
6680     if (item->size == 0) {
6681         return ERROR_CODE_PARAM_INVALID;
6682     }
6683     auto* fullImpl = GetFullImpl();
6684     fullImpl->getNodeModifiers()->getToggleModifier()->setToggleIsOn(
6685         node->uiNodeHandle, item->value[0].i32);
6686     return ERROR_CODE_NO_ERROR;
6687 }
6688 
GetToggleValue(ArkUI_NodeHandle node)6689 const ArkUI_AttributeItem* GetToggleValue(ArkUI_NodeHandle node)
6690 {
6691     auto resultValue =
6692         GetFullImpl()->getNodeModifiers()->getToggleModifier()->getToggleIsOn(node->uiNodeHandle);
6693     g_numberValues[0].i32 = resultValue;
6694     return &g_attributeItem;
6695 }
6696 
ResetToggleValue(ArkUI_NodeHandle node)6697 void ResetToggleValue(ArkUI_NodeHandle node)
6698 {
6699     auto* fullImpl = GetFullImpl();
6700     fullImpl->getNodeModifiers()->getToggleModifier()->resetToggleIsOn(node->uiNodeHandle);
6701 }
6702 
SetToggleUnselectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6703 int32_t SetToggleUnselectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6704 {
6705     if (item->size == 0) {
6706         return ERROR_CODE_PARAM_INVALID;
6707     }
6708     auto* fullImpl = GetFullImpl();
6709 
6710     fullImpl->getNodeModifiers()->getToggleModifier()->setToggleUnselectedColor(node->uiNodeHandle, item->value[0].u32);
6711     return ERROR_CODE_NO_ERROR;
6712 }
6713 
GetToggleUnselectedColor(ArkUI_NodeHandle node)6714 const ArkUI_AttributeItem* GetToggleUnselectedColor(ArkUI_NodeHandle node)
6715 {
6716     auto resultValue =
6717         GetFullImpl()->getNodeModifiers()->getToggleModifier()->getToggleUnselectedColor(node->uiNodeHandle);
6718     g_numberValues[0].u32 = resultValue;
6719     return &g_attributeItem;
6720 }
6721 
ResetToggleUnselectedColor(ArkUI_NodeHandle node)6722 void ResetToggleUnselectedColor(ArkUI_NodeHandle node)
6723 {
6724     auto* fullImpl = GetFullImpl();
6725     fullImpl->getNodeModifiers()->getToggleModifier()->resetToggleUnselectedColor(node->uiNodeHandle);
6726 }
6727 
6728 // LoadingProgress Attributes functions
GetLoadingProgressColor(ArkUI_NodeHandle node)6729 const ArkUI_AttributeItem* GetLoadingProgressColor(ArkUI_NodeHandle node)
6730 {
6731     auto modifier = GetFullImpl()->getNodeModifiers()->getLoadingProgressModifier();
6732 
6733     g_numberValues[0].u32 = modifier->getColor(node->uiNodeHandle);
6734     return &g_attributeItem;
6735 }
6736 
SetLoadingProgressColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6737 int32_t SetLoadingProgressColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6738 {
6739     // already check in entry point.
6740     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6741     if (actualSize < 0) {
6742         return ERROR_CODE_PARAM_INVALID;
6743     }
6744     auto fullImpl = GetFullImpl();
6745 
6746     fullImpl->getNodeModifiers()->getLoadingProgressModifier()->setColor(node->uiNodeHandle, item->value[NUM_0].u32);
6747     return ERROR_CODE_NO_ERROR;
6748 }
6749 
ResetLoadingProgressColor(ArkUI_NodeHandle node)6750 void ResetLoadingProgressColor(ArkUI_NodeHandle node)
6751 {
6752     auto fullImpl = GetFullImpl();
6753 
6754     fullImpl->getNodeModifiers()->getLoadingProgressModifier()->resetColor(node->uiNodeHandle);
6755 }
6756 
GetLoadingProgressEnableLoading(ArkUI_NodeHandle node)6757 const ArkUI_AttributeItem* GetLoadingProgressEnableLoading(ArkUI_NodeHandle node)
6758 {
6759     auto modifier = GetFullImpl()->getNodeModifiers()->getLoadingProgressModifier();
6760 
6761     g_numberValues[0].i32 = modifier->getEnableLoading(node->uiNodeHandle);
6762     return &g_attributeItem;
6763 }
6764 
SetLoadingProgressEnableLoading(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6765 int32_t SetLoadingProgressEnableLoading(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6766 {
6767     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6768     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6769         return ERROR_CODE_PARAM_INVALID;
6770     }
6771     auto fullImpl = GetFullImpl();
6772 
6773     fullImpl->getNodeModifiers()->getLoadingProgressModifier()->setEnableLoading(
6774         node->uiNodeHandle, item->value[NUM_0].i32);
6775     return ERROR_CODE_NO_ERROR;
6776 }
6777 
ResetLoadingProgressEnableLoading(ArkUI_NodeHandle node)6778 void ResetLoadingProgressEnableLoading(ArkUI_NodeHandle node)
6779 {
6780     auto fullImpl = GetFullImpl();
6781 
6782     fullImpl->getNodeModifiers()->getLoadingProgressModifier()->resetEnableLoading(node->uiNodeHandle);
6783 }
6784 
6785 // Swiper Attributes functions
SetSwiperLoop(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6786 int32_t SetSwiperLoop(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6787 {
6788     if (item->size == 0) {
6789         return ERROR_CODE_PARAM_INVALID;
6790     }
6791     if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6792         return ERROR_CODE_PARAM_INVALID;
6793     }
6794     auto* fullImpl = GetFullImpl();
6795     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperLoop(
6796         node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
6797     return ERROR_CODE_NO_ERROR;
6798 }
6799 
ResetSwiperLoop(ArkUI_NodeHandle node)6800 void ResetSwiperLoop(ArkUI_NodeHandle node)
6801 {
6802     auto* fullImpl = GetFullImpl();
6803     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperLoop(node->uiNodeHandle);
6804 }
6805 
GetSwiperLoop(ArkUI_NodeHandle node)6806 const ArkUI_AttributeItem* GetSwiperLoop(ArkUI_NodeHandle node)
6807 {
6808     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6809     g_numberValues[0].i32 = modifier->getSwiperLoop(node->uiNodeHandle);
6810     return &g_attributeItem;
6811 }
6812 
SetSwiperAutoPlay(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6813 int32_t SetSwiperAutoPlay(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6814 {
6815     if (item->size == 0) {
6816         return ERROR_CODE_PARAM_INVALID;
6817     }
6818     if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6819         return ERROR_CODE_PARAM_INVALID;
6820     }
6821     auto* fullImpl = GetFullImpl();
6822     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperAutoPlay(node->uiNodeHandle, item->value[0].i32);
6823     return ERROR_CODE_NO_ERROR;
6824 }
6825 
ResetSwiperAutoPlay(ArkUI_NodeHandle node)6826 void ResetSwiperAutoPlay(ArkUI_NodeHandle node)
6827 {
6828     auto* fullImpl = GetFullImpl();
6829     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperAutoPlay(node->uiNodeHandle);
6830 }
6831 
GetSwiperAutoPlay(ArkUI_NodeHandle node)6832 const ArkUI_AttributeItem* GetSwiperAutoPlay(ArkUI_NodeHandle node)
6833 {
6834     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6835     g_numberValues[0].i32 = modifier->getSwiperAutoPlay(node->uiNodeHandle);
6836     return &g_attributeItem;
6837 }
6838 
SetSwiperShowIndicator(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6839 int32_t SetSwiperShowIndicator(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6840 {
6841     if (item->size == 0) {
6842         return ERROR_CODE_PARAM_INVALID;
6843     }
6844     if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6845         return ERROR_CODE_PARAM_INVALID;
6846     }
6847     auto* fullImpl = GetFullImpl();
6848     std::vector<std::string> IndicatorProps = { "boolean", "true" };
6849     IndicatorProps[NUM_1] = std::to_string(item->value[0].i32);
6850     std::stringstream ss;
6851     for (const auto& str : IndicatorProps) {
6852         ss << str << "|";
6853     }
6854     std::string result;
6855     ss >> result;
6856     if (!result.empty()) {
6857         result.pop_back(); // 删除最后一个字符
6858     }
6859     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperIndicator(node->uiNodeHandle, result.c_str());
6860     return ERROR_CODE_NO_ERROR;
6861 }
6862 
ResetSwiperShowIndicator(ArkUI_NodeHandle node)6863 void ResetSwiperShowIndicator(ArkUI_NodeHandle node)
6864 {
6865     auto* fullImpl = GetFullImpl();
6866     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperIndicator(node->uiNodeHandle);
6867 }
6868 
GetSwiperShowIndicator(ArkUI_NodeHandle node)6869 const ArkUI_AttributeItem* GetSwiperShowIndicator(ArkUI_NodeHandle node)
6870 {
6871     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6872     g_numberValues[0].i32 = modifier->getSwiperShowIndicator(node->uiNodeHandle);
6873     return &g_attributeItem;
6874 }
6875 
SetSwiperInterval(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6876 int32_t SetSwiperInterval(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6877 {
6878     if (item->size == 0) {
6879         return ERROR_CODE_PARAM_INVALID;
6880     }
6881     if (LessNotEqual(item->value[0].f32, 0.0f)) {
6882         return ERROR_CODE_PARAM_INVALID;
6883     }
6884     auto* fullImpl = GetFullImpl();
6885     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperInterval(
6886         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].f32));
6887     return ERROR_CODE_NO_ERROR;
6888 }
6889 
ResetSwiperInterval(ArkUI_NodeHandle node)6890 void ResetSwiperInterval(ArkUI_NodeHandle node)
6891 {
6892     auto* fullImpl = GetFullImpl();
6893     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperInterval(node->uiNodeHandle);
6894 }
6895 
GetSwiperInterval(ArkUI_NodeHandle node)6896 const ArkUI_AttributeItem* GetSwiperInterval(ArkUI_NodeHandle node)
6897 {
6898     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6899     g_numberValues[0].f32 = modifier->getSwiperInterval(node->uiNodeHandle);
6900     return &g_attributeItem;
6901 }
6902 
SetSwiperVertical(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6903 int32_t SetSwiperVertical(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6904 {
6905     if (item->size == 0) {
6906         return ERROR_CODE_PARAM_INVALID;
6907     }
6908     if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6909         return ERROR_CODE_PARAM_INVALID;
6910     }
6911     auto* fullImpl = GetFullImpl();
6912     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperVertical(
6913         node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
6914     return ERROR_CODE_NO_ERROR;
6915 }
6916 
ResetSwiperVertical(ArkUI_NodeHandle node)6917 void ResetSwiperVertical(ArkUI_NodeHandle node)
6918 {
6919     auto* fullImpl = GetFullImpl();
6920     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperVertical(node->uiNodeHandle);
6921 }
6922 
GetSwiperVertical(ArkUI_NodeHandle node)6923 const ArkUI_AttributeItem* GetSwiperVertical(ArkUI_NodeHandle node)
6924 {
6925     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6926     g_numberValues[0].i32 = modifier->getSwiperVertical(node->uiNodeHandle);
6927     return &g_attributeItem;
6928 }
6929 
SetSwiperDuration(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6930 int32_t SetSwiperDuration(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6931 {
6932     if (item->size == 0) {
6933         return ERROR_CODE_PARAM_INVALID;
6934     }
6935     if (LessNotEqual(item->value[0].f32, 0.0f)) {
6936         return ERROR_CODE_PARAM_INVALID;
6937     }
6938     auto* fullImpl = GetFullImpl();
6939     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperDuration(node->uiNodeHandle, item->value[0].f32);
6940     return ERROR_CODE_NO_ERROR;
6941 }
6942 
ResetSwiperDuration(ArkUI_NodeHandle node)6943 void ResetSwiperDuration(ArkUI_NodeHandle node)
6944 {
6945     auto* fullImpl = GetFullImpl();
6946     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperDuration(node->uiNodeHandle);
6947 }
6948 
GetSwiperDuration(ArkUI_NodeHandle node)6949 const ArkUI_AttributeItem* GetSwiperDuration(ArkUI_NodeHandle node)
6950 {
6951     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6952     g_numberValues[0].f32 = modifier->getSwiperDuration(node->uiNodeHandle);
6953     return &g_attributeItem;
6954 }
6955 
SetSwiperCurve(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6956 int32_t SetSwiperCurve(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6957 {
6958     if (item->size == 0) {
6959         return ERROR_CODE_PARAM_INVALID;
6960     }
6961     if (item->value[0].i32 < ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR ||
6962         item->value[0].i32 > ArkUI_AnimationCurve::ARKUI_CURVE_FRICTION) {
6963         return ERROR_CODE_PARAM_INVALID;
6964     }
6965     auto* fullImpl = GetFullImpl();
6966     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperCurve(
6967         node->uiNodeHandle, CurveToString(item->value[0].i32).c_str());
6968     return ERROR_CODE_NO_ERROR;
6969 }
6970 
ResetSwiperCurve(ArkUI_NodeHandle node)6971 void ResetSwiperCurve(ArkUI_NodeHandle node)
6972 {
6973     auto* fullImpl = GetFullImpl();
6974     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperCurve(node->uiNodeHandle);
6975 }
6976 
GetSwiperCurve(ArkUI_NodeHandle node)6977 const ArkUI_AttributeItem* GetSwiperCurve(ArkUI_NodeHandle node)
6978 {
6979     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6980     g_numberValues[0].i32 = modifier->getSwiperCurve(node->uiNodeHandle);
6981     return &g_attributeItem;
6982 }
6983 
SetSwiperItemSpace(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6984 int32_t SetSwiperItemSpace(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6985 {
6986     if (item->size == 0) {
6987         return ERROR_CODE_PARAM_INVALID;
6988     }
6989     if (LessNotEqual(item->value[0].f32, 0.0f)) {
6990         return ERROR_CODE_PARAM_INVALID;
6991     }
6992     auto* fullImpl = GetFullImpl();
6993     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperItemSpace(
6994         node->uiNodeHandle, item->value[0].f32, NUM_1);
6995     return ERROR_CODE_NO_ERROR;
6996 }
6997 
ResetSwiperItemSpace(ArkUI_NodeHandle node)6998 void ResetSwiperItemSpace(ArkUI_NodeHandle node)
6999 {
7000     auto* fullImpl = GetFullImpl();
7001     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperItemSpace(node->uiNodeHandle);
7002 }
7003 
GetSwiperItemSpace(ArkUI_NodeHandle node)7004 const ArkUI_AttributeItem* GetSwiperItemSpace(ArkUI_NodeHandle node)
7005 {
7006     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7007     g_numberValues[0].f32 = modifier->getSwiperItemSpace(node->uiNodeHandle);
7008     return &g_attributeItem;
7009 }
7010 
SetSwiperIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7011 int32_t SetSwiperIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7012 {
7013     if (item->size == 0) {
7014         return ERROR_CODE_PARAM_INVALID;
7015     }
7016     if (item->value[0].i32 < 0) {
7017         return ERROR_CODE_PARAM_INVALID;
7018     }
7019     auto* fullImpl = GetFullImpl();
7020     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperIndex(node->uiNodeHandle, item->value[0].i32);
7021     return ERROR_CODE_NO_ERROR;
7022 }
7023 
ResetSwiperIndex(ArkUI_NodeHandle node)7024 void ResetSwiperIndex(ArkUI_NodeHandle node)
7025 {
7026     auto* fullImpl = GetFullImpl();
7027     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperIndex(node->uiNodeHandle);
7028 }
7029 
GetSwiperIndex(ArkUI_NodeHandle node)7030 const ArkUI_AttributeItem* GetSwiperIndex(ArkUI_NodeHandle node)
7031 {
7032     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7033     g_numberValues[0].i32 = modifier->getSwiperIndex(node->uiNodeHandle);
7034     return &g_attributeItem;
7035 }
7036 
SetSwiperDisplayCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7037 int32_t SetSwiperDisplayCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7038 {
7039     if (item->size == 0) {
7040         return ERROR_CODE_PARAM_INVALID;
7041     }
7042     if (LessNotEqual(item->value[0].f32, 0.0f)) {
7043         return ERROR_CODE_PARAM_INVALID;
7044     }
7045     auto* fullImpl = GetFullImpl();
7046     std::string type = "number";
7047     std::string displayCount = std::to_string(item->value[0].i32);
7048     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperDisplayCount(
7049         node->uiNodeHandle, displayCount.c_str(), type.c_str());
7050     return ERROR_CODE_NO_ERROR;
7051 }
7052 
ResetSwiperDisplayCount(ArkUI_NodeHandle node)7053 void ResetSwiperDisplayCount(ArkUI_NodeHandle node)
7054 {
7055     auto* fullImpl = GetFullImpl();
7056     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperDisplayCount(node->uiNodeHandle);
7057 }
7058 
GetSwiperDisplayCount(ArkUI_NodeHandle node)7059 const ArkUI_AttributeItem* GetSwiperDisplayCount(ArkUI_NodeHandle node)
7060 {
7061     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7062     g_numberValues[0].i32 = modifier->getSwiperDisplayCount(node->uiNodeHandle);
7063     return &g_attributeItem;
7064 }
7065 
SetSwiperDisableSwipe(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7066 int32_t SetSwiperDisableSwipe(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7067 {
7068     if (item->size == 0) {
7069         return ERROR_CODE_PARAM_INVALID;
7070     }
7071     if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
7072         return ERROR_CODE_PARAM_INVALID;
7073     }
7074     auto* fullImpl = GetFullImpl();
7075     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperDisableSwipe(
7076         node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
7077     return ERROR_CODE_NO_ERROR;
7078 }
7079 
ResetSwiperDisableSwipe(ArkUI_NodeHandle node)7080 void ResetSwiperDisableSwipe(ArkUI_NodeHandle node)
7081 {
7082     auto* fullImpl = GetFullImpl();
7083     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperDisableSwipe(node->uiNodeHandle);
7084 }
7085 
GetSwiperDisableSwipe(ArkUI_NodeHandle node)7086 const ArkUI_AttributeItem* GetSwiperDisableSwipe(ArkUI_NodeHandle node)
7087 {
7088     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7089     g_numberValues[0].i32 = modifier->getSwiperDisableSwipe(node->uiNodeHandle);
7090     return &g_attributeItem;
7091 }
7092 
SetSwiperShowDisplayArrow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7093 int32_t SetSwiperShowDisplayArrow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7094 {
7095     if (item->size == 0) {
7096         return ERROR_CODE_PARAM_INVALID;
7097     }
7098     if (!InRegion(NUM_0, NUM_2, item->value[NUM_0].i32)) {
7099         return ERROR_CODE_PARAM_INVALID;
7100     }
7101     auto* fullImpl = GetFullImpl();
7102     double defaultBackgroundColor = StringToColorInt("#00000000", 0);
7103     double defaultArrowColor = StringToColorInt("#FF182431", 0);
7104     double displayArrow[ALLOW_SIZE_8] = { 1, 0, 0, DEFAULT_SIZE_24, defaultBackgroundColor, DEFAULT_SIZE_18,
7105         defaultArrowColor, 0 };
7106     if (item->value[0].i32 == ArkUI_SwiperArrow::ARKUI_SWIPER_ARROW_SHOW_ON_HOVER) {
7107         displayArrow[NUM_0] = DISPLAY_ARROW_TRUE;
7108         displayArrow[NUM_7] = DISPLAY_ARROW_TRUE;
7109     } else {
7110         displayArrow[NUM_0] = item->value[0].i32;
7111         displayArrow[NUM_7] = DISPLAY_ARROW_FALSE;
7112     }
7113     std::stringstream ss;
7114     for (const auto& str : displayArrow) {
7115         ss << str << "|";
7116     }
7117     std::string result;
7118     ss >> result;
7119     if (!result.empty()) {
7120         result.pop_back(); // 删除最后一个字符
7121     }
7122     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperDisplayArrow(node->uiNodeHandle, result.c_str());
7123     return ERROR_CODE_NO_ERROR;
7124 }
7125 
ResetSwiperShowDisplayArrow(ArkUI_NodeHandle node)7126 void ResetSwiperShowDisplayArrow(ArkUI_NodeHandle node)
7127 {
7128     auto* fullImpl = GetFullImpl();
7129     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperDisplayArrow(node->uiNodeHandle);
7130 }
7131 
GetSwiperShowDisplayArrow(ArkUI_NodeHandle node)7132 const ArkUI_AttributeItem* GetSwiperShowDisplayArrow(ArkUI_NodeHandle node)
7133 {
7134     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7135     g_numberValues[0].i32 = modifier->getSwiperShowDisplayArrow(node->uiNodeHandle);
7136     return &g_attributeItem;
7137 }
7138 
SetSwiperEffectMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7139 int32_t SetSwiperEffectMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7140 {
7141     if (item->size == 0) {
7142         return ERROR_CODE_PARAM_INVALID;
7143     }
7144     if (item->value[0].i32 < ArkUI_EdgeEffect::ARKUI_EDGE_EFFECT_SPRING ||
7145         item->value[0].i32 > ArkUI_EdgeEffect::ARKUI_EDGE_EFFECT_NONE) {
7146         return ERROR_CODE_PARAM_INVALID;
7147     }
7148     auto* fullImpl = GetFullImpl();
7149     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperEffectMode(
7150         node->uiNodeHandle, static_cast<ArkUI_Int32>(item->value[0].i32));
7151     return ERROR_CODE_NO_ERROR;
7152 }
7153 
ResetSwiperEffectMode(ArkUI_NodeHandle node)7154 void ResetSwiperEffectMode(ArkUI_NodeHandle node)
7155 {
7156     auto* fullImpl = GetFullImpl();
7157     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperEffectMode(node->uiNodeHandle);
7158 }
7159 
GetSwiperEffectMode(ArkUI_NodeHandle node)7160 const ArkUI_AttributeItem* GetSwiperEffectMode(ArkUI_NodeHandle node)
7161 {
7162     auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7163     g_numberValues[0].i32 = modifier->getSwiperEffectMode(node->uiNodeHandle);
7164     return &g_attributeItem;
7165 }
7166 
SetSwiperNodeAdapter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7167 int32_t SetSwiperNodeAdapter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7168 {
7169     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
7170     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
7171     auto* nodeAdapter = reinterpret_cast<ArkUINodeAdapterHandle>(item->object);
7172     return GetFullImpl()->getNodeModifiers()->getSwiperModifier()->setNodeAdapter(node->uiNodeHandle, nodeAdapter);
7173 }
7174 
ResetSwiperNodeAdapter(ArkUI_NodeHandle node)7175 void ResetSwiperNodeAdapter(ArkUI_NodeHandle node)
7176 {
7177     // already check in entry point.
7178     auto* fullImpl = GetFullImpl();
7179 
7180     fullImpl->getNodeModifiers()->getSwiperModifier()->resetNodeAdapter(node->uiNodeHandle);
7181 }
7182 
GetSwiperNodeAdapter(ArkUI_NodeHandle node)7183 const ArkUI_AttributeItem* GetSwiperNodeAdapter(ArkUI_NodeHandle node)
7184 {
7185     ArkUINodeAdapterHandle adapter =
7186         GetFullImpl()->getNodeModifiers()->getSwiperModifier()->getNodeAdapter(node->uiNodeHandle);
7187     g_attributeItem.object = reinterpret_cast<void*>(adapter);
7188     return &g_attributeItem;
7189 }
7190 
SetSwiperCachedCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7191 int32_t SetSwiperCachedCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7192 {
7193     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
7194     if (item->size != 1) {
7195         return ERROR_CODE_PARAM_INVALID;
7196     }
7197     if (LessNotEqual(item->value[0].i32, NUM_0)) {
7198         return ERROR_CODE_PARAM_INVALID;
7199     }
7200     GetFullImpl()->getNodeModifiers()->getSwiperModifier()->setSwiperCachedCount(
7201         node->uiNodeHandle, item->value[0].i32);
7202     return ERROR_CODE_NO_ERROR;
7203 }
7204 
ResetSwiperCachedCount(ArkUI_NodeHandle node)7205 void ResetSwiperCachedCount(ArkUI_NodeHandle node)
7206 {
7207     // already check in entry point.
7208     auto* fullImpl = GetFullImpl();
7209 
7210     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperCachedCount(node->uiNodeHandle);
7211 }
7212 
GetSwiperCachedCount(ArkUI_NodeHandle node)7213 const ArkUI_AttributeItem* GetSwiperCachedCount(ArkUI_NodeHandle node)
7214 {
7215     ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getSwiperModifier()->getCachedCount(node->uiNodeHandle);
7216     g_numberValues[0].i32 = value;
7217     return &g_attributeItem;
7218 }
7219 
SetSwiperNestedScroll(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7220 int32_t SetSwiperNestedScroll(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7221 {
7222     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7223     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
7224         return ERROR_CODE_PARAM_INVALID;
7225     }
7226     ArkUI_Int32 values[ALLOW_SIZE_1] = {0};
7227     values[0] = item->value[0].i32;
7228 
7229     auto* fullImpl = GetFullImpl();
7230     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperNestedScroll(node->uiNodeHandle, &values);
7231     return ERROR_CODE_NO_ERROR;
7232 }
7233 
ResetSwiperNestedScroll(ArkUI_NodeHandle node)7234 void ResetSwiperNestedScroll(ArkUI_NodeHandle node)
7235 {
7236     auto* fullImpl = GetFullImpl();
7237     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperNestedScroll(node->uiNodeHandle);
7238 }
7239 
GetSwiperNestedScroll(ArkUI_NodeHandle node)7240 const ArkUI_AttributeItem* GetSwiperNestedScroll(ArkUI_NodeHandle node)
7241 {
7242     auto* fullImpl = GetFullImpl();
7243     ArkUI_Int32 value = fullImpl->getNodeModifiers()->getSwiperModifier()->getSwiperNestedScroll(node->uiNodeHandle);
7244     g_numberValues[0].i32 = value;
7245     return &g_attributeItem;
7246 }
7247 
SetSwiperToIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7248 int32_t SetSwiperToIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7249 {
7250     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7251     if (actualSize < 0) {
7252         return ERROR_CODE_PARAM_INVALID;
7253     }
7254     ArkUI_Int32 values[ALLOW_SIZE_2] = { 0, DEFAULT_FALSE };
7255     values[0] = item->value[0].i32;
7256     if (item->size > 1 && InRegion(NUM_0, NUM_1, item->value[1].i32)) {
7257         values[1] = item->value[1].i32;
7258     }
7259     auto* fullImpl = GetFullImpl();
7260     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperToIndex(node->uiNodeHandle, &values);
7261     return ERROR_CODE_NO_ERROR;
7262 }
7263 
SetSwiperPrevMargin(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7264 int32_t SetSwiperPrevMargin(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7265 {
7266     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7267     if (actualSize < NUM_0) {
7268         return ERROR_CODE_PARAM_INVALID;
7269     }
7270     if (LessNotEqual(item->value[0].f32, 0.0f)) {
7271         return ERROR_CODE_PARAM_INVALID;
7272     }
7273     ArkUI_Bool ignoreBlank = DEFAULT_FALSE;
7274     if (actualSize > NUM_1 && InRegion(DEFAULT_FALSE, DEFAULT_TRUE, item->value[1].i32)) {
7275         ignoreBlank = item->value[1].i32;
7276     }
7277     // already check in entry point.
7278     auto* fullImpl = GetFullImpl();
7279     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperPrevMargin(
7280         node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_VP), ignoreBlank);
7281     return ERROR_CODE_NO_ERROR;
7282 }
7283 
ResetSwiperPrevMargin(ArkUI_NodeHandle node)7284 void ResetSwiperPrevMargin(ArkUI_NodeHandle node)
7285 {
7286     // already check in entry point.
7287     auto* fullImpl = GetFullImpl();
7288     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperPrevMargin(node->uiNodeHandle);
7289 }
7290 
GetSwiperPrevMargin(ArkUI_NodeHandle node)7291 const ArkUI_AttributeItem* GetSwiperPrevMargin(ArkUI_NodeHandle node)
7292 {
7293     // already check in entry point.
7294     auto* fullImpl = GetFullImpl();
7295     int32_t unit = GetDefaultUnit(node, UNIT_VP);
7296     ArkUISwiperMarginOptions options;
7297     fullImpl->getNodeModifiers()->getSwiperModifier()->getSwiperPrevMargin(node->uiNodeHandle, unit, &options);
7298     g_numberValues[0].f32 = options.margin;
7299     g_numberValues[1].i32 = options.ignoreBlank;
7300     g_attributeItem.size = REQUIRED_TWO_PARAM;
7301     return &g_attributeItem;
7302 }
7303 
SetSwiperNextMargin(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7304 int32_t SetSwiperNextMargin(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7305 {
7306     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7307     if (actualSize < NUM_0) {
7308         return ERROR_CODE_PARAM_INVALID;
7309     }
7310     if (LessNotEqual(item->value[0].f32, 0.0f)) {
7311         return ERROR_CODE_PARAM_INVALID;
7312     }
7313     ArkUI_Bool ignoreBlank = DEFAULT_FALSE;
7314     if (actualSize > NUM_1 && InRegion(DEFAULT_FALSE, DEFAULT_TRUE, item->value[1].i32)) {
7315         ignoreBlank = item->value[1].i32;
7316     }
7317     // already check in entry point.
7318     auto* fullImpl = GetFullImpl();
7319     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperNextMargin(
7320         node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_VP), ignoreBlank);
7321     return ERROR_CODE_NO_ERROR;
7322 }
7323 
ResetSwiperNextMargin(ArkUI_NodeHandle node)7324 void ResetSwiperNextMargin(ArkUI_NodeHandle node)
7325 {
7326     // already check in entry point.
7327     auto* fullImpl = GetFullImpl();
7328     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperNextMargin(node->uiNodeHandle);
7329 }
7330 
GetSwiperNextMargin(ArkUI_NodeHandle node)7331 const ArkUI_AttributeItem* GetSwiperNextMargin(ArkUI_NodeHandle node)
7332 {
7333     // already check in entry point.
7334     auto* fullImpl = GetFullImpl();
7335     int32_t unit = GetDefaultUnit(node, UNIT_VP);
7336     ArkUISwiperMarginOptions options;
7337     fullImpl->getNodeModifiers()->getSwiperModifier()->getSwiperNextMargin(node->uiNodeHandle, unit, &options);
7338     g_numberValues[0].f32 = options.margin;
7339     g_numberValues[1].i32 = options.ignoreBlank;
7340     g_attributeItem.size = REQUIRED_TWO_PARAM;
7341     return &g_attributeItem;
7342 }
7343 
SetSwiperIndicator(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7344 int32_t SetSwiperIndicator(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7345 {
7346     if (item->size == 0) {
7347         return ERROR_CODE_PARAM_INVALID;
7348     }
7349     if (!CheckAttributeIndicator(item)) {
7350         return ERROR_CODE_PARAM_INVALID;
7351     }
7352 
7353     ArkUI_SwiperIndicator* indicator = reinterpret_cast<ArkUI_SwiperIndicator*>(item->object);
7354     CHECK_NULL_RETURN(indicator, ERROR_CODE_PARAM_INVALID);
7355     node->swiperIndicator = indicator;
7356     ArkUISwiperIndicator indicatorProp;
7357     indicatorProp.dimUnit = GetDefaultUnit(node, UNIT_VP);
7358     indicatorProp.dimLeft = ArkUIOptionalFloat { indicator->dimLeft.isSet, indicator->dimLeft.value };
7359     indicatorProp.dimTop = ArkUIOptionalFloat { indicator->dimTop.isSet, indicator->dimTop.value };
7360     indicatorProp.dimRight = ArkUIOptionalFloat { indicator->dimRight.isSet, indicator->dimRight.value };
7361     indicatorProp.dimBottom = ArkUIOptionalFloat { indicator->dimBottom.isSet, indicator->dimBottom.value };
7362     if (indicator->type == ARKUI_SWIPER_INDICATOR_TYPE_DOT) {
7363         indicatorProp.type = ArkUISwiperIndicatorType::DOT;
7364         indicatorProp.itemWidth = ArkUIOptionalFloat { indicator->itemWidth.isSet, indicator->itemWidth.value };
7365         indicatorProp.itemHeight = ArkUIOptionalFloat { indicator->itemHeight.isSet, indicator->itemHeight.value };
7366         indicatorProp.selectedItemWidth =
7367             ArkUIOptionalFloat { indicator->selectedItemWidth.isSet, indicator->selectedItemWidth.value };
7368         indicatorProp.selectedItemHeight =
7369             ArkUIOptionalFloat { indicator->selectedItemHeight.isSet, indicator->selectedItemHeight.value };
7370         indicatorProp.maskValue = ArkUIOptionalInt { indicator->maskValue.isSet, indicator->maskValue.value };
7371         indicatorProp.colorValue = ArkUIOptionalUint { indicator->colorValue.isSet, indicator->colorValue.value };
7372         indicatorProp.selectedColorValue =
7373             ArkUIOptionalUint { indicator->selectedColorValue.isSet, indicator->selectedColorValue.value };
7374         indicatorProp.maxDisplayCount =
7375         ArkUIOptionalInt { indicator->maxDisplayCount.isSet, indicator->maxDisplayCount.value };
7376     } else {
7377         return ERROR_CODE_PARAM_INVALID;
7378     }
7379 
7380     auto* fullImpl = GetFullImpl();
7381     fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperIndicatorStyle(node->uiNodeHandle, &indicatorProp);
7382     return ERROR_CODE_NO_ERROR;
7383 }
7384 
ResetSwiperIndicator(ArkUI_NodeHandle node)7385 void ResetSwiperIndicator(ArkUI_NodeHandle node)
7386 {
7387     auto* fullImpl = GetFullImpl();
7388     fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperIndicator(node->uiNodeHandle);
7389     node->swiperIndicator = nullptr;
7390 }
7391 
GetSwiperIndicator(ArkUI_NodeHandle node)7392 const ArkUI_AttributeItem* GetSwiperIndicator(ArkUI_NodeHandle node)
7393 {
7394     ArkUI_SwiperIndicator* indicator = reinterpret_cast<ArkUI_SwiperIndicator*>(node->swiperIndicator);
7395     if (!indicator) {
7396         return &g_attributeItem;
7397     }
7398     auto* fullImpl = GetFullImpl();
7399     ArkUISwiperIndicator props;
7400     fullImpl->getNodeModifiers()->getSwiperModifier()->getSwiperIndicator(node->uiNodeHandle, &props);
7401     indicator->dimLeft.value = props.dimLeft.value;
7402     indicator->dimTop.value = props.dimTop.value;
7403     indicator->dimRight.value = props.dimRight.value;
7404     indicator->dimBottom.value = props.dimBottom.value;
7405     if (props.type == ArkUISwiperIndicatorType::DOT) {
7406         indicator->itemWidth.value = props.itemWidth.value;
7407         indicator->itemHeight.value = props.itemHeight.value;
7408         indicator->selectedItemWidth.value = props.selectedItemWidth.value;
7409         indicator->selectedItemHeight.value = props.selectedItemHeight.value;
7410         indicator->maskValue.value = props.maskValue.value;
7411         indicator->colorValue.value = props.colorValue.value;
7412         indicator->selectedColorValue.value = props.selectedColorValue.value;
7413         indicator->maxDisplayCount.value = props.maxDisplayCount.value;
7414     } else {
7415         indicator = nullptr;
7416     }
7417 
7418     g_numberValues[0].i32 = static_cast<int32_t>(props.type);
7419     g_attributeItem.size = REQUIRED_ONE_PARAM;
7420     g_attributeItem.object = indicator;
7421     return &g_attributeItem;
7422 }
7423 
SetSwiperIndicatorInteractive(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7424 int32_t SetSwiperIndicatorInteractive(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7425 {
7426     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7427     if (actualSize < 0) {
7428         return ERROR_CODE_PARAM_INVALID;
7429     }
7430     auto* fullImpl = GetFullImpl();
7431     fullImpl->getNodeModifiers()->getSwiperModifier()->setIndicatorInteractive(node->uiNodeHandle,
7432         static_cast<bool>(item->value[0].i32));
7433     return ERROR_CODE_NO_ERROR;
7434 }
7435 
ResetSwiperIndicatorInteractive(ArkUI_NodeHandle node)7436 void ResetSwiperIndicatorInteractive(ArkUI_NodeHandle node)
7437 {
7438     auto* fullImpl = GetFullImpl();
7439     fullImpl->getNodeModifiers()->getSwiperModifier()->resetIndicatorInteractive(node->uiNodeHandle);
7440 }
7441 
GetSwiperIndicatorInteractive(ArkUI_NodeHandle node)7442 const ArkUI_AttributeItem* GetSwiperIndicatorInteractive(ArkUI_NodeHandle node)
7443 {
7444     ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getSwiperModifier()->
7445         getIndicatorInteractive(node->uiNodeHandle);
7446     g_numberValues[0].i32 = value;
7447     return &g_attributeItem;
7448 }
7449 
SetTextFontFamily(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7450 int32_t SetTextFontFamily(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7451 {
7452     if (item->string == nullptr) {
7453         return ERROR_CODE_PARAM_INVALID;
7454     }
7455     auto* fullImpl = GetFullImpl();
7456     std::string value(item->string);
7457     std::vector<std::string> fontFamilies;
7458     StringUtils::StringSplitter(value, ',', fontFamilies);
7459     auto families = std::make_unique<char*[]>(fontFamilies.size());
7460     for (uint32_t i = 0; i < fontFamilies.size(); i++) {
7461         families[i] = const_cast<char*>(fontFamilies.at(i).c_str());
7462     }
7463 
7464     if (node->type == ARKUI_NODE_TEXT_INPUT) {
7465         fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontFamily(
7466             node->uiNodeHandle, const_cast<const char**>(families.get()), fontFamilies.size());
7467     } else if (node->type == ARKUI_NODE_TEXT) {
7468         fullImpl->getNodeModifiers()->getTextModifier()->setTextFontFamily(
7469             node->uiNodeHandle, const_cast<const char**>(families.get()), fontFamilies.size());
7470     } else if (node->type == ARKUI_NODE_SPAN) {
7471         fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontFamily(
7472             node->uiNodeHandle, const_cast<const char**>(families.get()), fontFamilies.size());
7473     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
7474         fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontFamily(node->uiNodeHandle, item->string);
7475     }
7476     return ERROR_CODE_NO_ERROR;
7477 }
7478 
GetTextFontFamily(ArkUI_NodeHandle node)7479 const ArkUI_AttributeItem* GetTextFontFamily(ArkUI_NodeHandle node)
7480 {
7481     if (node->type == ARKUI_NODE_SPAN) {
7482         auto resultValue = GetFullImpl()->getNodeModifiers()->getSpanModifier()->getSpanFontFamily(node->uiNodeHandle);
7483         g_attributeItem.string = resultValue;
7484     } else {
7485         auto resultValue = GetFullImpl()->getNodeModifiers()->getTextModifier()->getFontFamily(node->uiNodeHandle);
7486         g_attributeItem.string = resultValue;
7487     }
7488     g_attributeItem.size = 0;
7489     return &g_attributeItem;
7490 }
7491 
ResetTextFontFamily(ArkUI_NodeHandle node)7492 void ResetTextFontFamily(ArkUI_NodeHandle node)
7493 {
7494     auto* fullImpl = GetFullImpl();
7495     if (node->type == ARKUI_NODE_TEXT_INPUT) {
7496         fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontFamily(node->uiNodeHandle);
7497     } else if (node->type == ARKUI_NODE_TEXT) {
7498         fullImpl->getNodeModifiers()->getTextModifier()->resetTextFontFamily(node->uiNodeHandle);
7499     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
7500         fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontFamily(node->uiNodeHandle);
7501     }
7502 }
7503 
ResetTextCopyOption(ArkUI_NodeHandle node)7504 void ResetTextCopyOption(ArkUI_NodeHandle node)
7505 {
7506     auto* fullImpl = GetFullImpl();
7507     if (node->type == ARKUI_NODE_TEXT) {
7508         fullImpl->getNodeModifiers()->getTextModifier()->resetTextCopyOption(node->uiNodeHandle);
7509     }
7510 }
7511 
SetTextCopyOption(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7512 int32_t SetTextCopyOption(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7513 {
7514     if (item->size == NUM_0 || !CheckAttributeIsCopyOptions(item->value[0].i32)) {
7515         return ERROR_CODE_PARAM_INVALID;
7516     }
7517     // already check in entry point.
7518     auto* fullImpl = GetFullImpl();
7519     if (node->type == ARKUI_NODE_TEXT) {
7520         fullImpl->getNodeModifiers()->getTextModifier()->setTextCopyOption(node->uiNodeHandle, item->value[0].i32);
7521     } else {
7522         return ERROR_CODE_PARAM_INVALID;
7523     }
7524     return ERROR_CODE_NO_ERROR;
7525 }
7526 
GetTextCopyOption(ArkUI_NodeHandle node)7527 const ArkUI_AttributeItem* GetTextCopyOption(ArkUI_NodeHandle node)
7528 {
7529     auto resultValue = GetFullImpl()->getNodeModifiers()->getTextModifier()->getCopyOption(node->uiNodeHandle);
7530     g_numberValues[0].i32 = resultValue;
7531     return &g_attributeItem;
7532 }
7533 
GetBaseLineOffset(ArkUI_NodeHandle node)7534 const ArkUI_AttributeItem* GetBaseLineOffset(ArkUI_NodeHandle node)
7535 {
7536     auto* fullImpl = GetFullImpl();
7537     if (node->type == ARKUI_NODE_SPAN) {
7538         g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getSpanModifier()->getSpanBaselineOffset(
7539             node->uiNodeHandle);
7540     } else {
7541         g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextBaselineOffset(
7542             node->uiNodeHandle);
7543     }
7544     g_attributeItem.size = REQUIRED_ONE_PARAM;
7545     return &g_attributeItem;
7546 }
7547 
GetTextShadow(ArkUI_NodeHandle node)7548 const ArkUI_AttributeItem* GetTextShadow(ArkUI_NodeHandle node)
7549 {
7550     auto* fullImpl = GetFullImpl();
7551     ArkUITextShadowStruct shadowArray[NUM_1];
7552     if (node->type == ARKUI_NODE_TEXT) {
7553         fullImpl->getNodeModifiers()->getTextModifier()->getTextShadows(node->uiNodeHandle, &shadowArray[0], NUM_1);
7554     } else if (node->type == ARKUI_NODE_SPAN) {
7555         fullImpl->getNodeModifiers()->getSpanModifier()->getTextShadows(node->uiNodeHandle, &shadowArray[0], NUM_1);
7556     }
7557     g_numberValues[NUM_0].f32 = shadowArray[0].radius;
7558     g_numberValues[NUM_1].i32 = static_cast<int32_t>(shadowArray[0].type);
7559     g_numberValues[NUM_2].u32 = shadowArray[0].color;
7560     g_numberValues[NUM_3].f32 = shadowArray[0].offsetX;
7561     g_numberValues[NUM_4].f32 = shadowArray[0].offsetY;
7562     g_attributeItem.size = REQUIRED_FIVE_PARAM;
7563     return &g_attributeItem;
7564 }
7565 
7566 // ListItemGroup
SetListItemGroupHeader(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7567 int32_t SetListItemGroupHeader(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7568 {
7569     if (!item->object) {
7570         return ERROR_CODE_PARAM_INVALID;
7571     }
7572     auto fullImpl = GetFullImpl();
7573     auto headerNodeHandle = reinterpret_cast<ArkUI_NodeHandle>(item->object);
7574     fullImpl->getNodeModifiers()->getListItemGroupModifier()->listItemGroupSetHeader(
7575         node->uiNodeHandle, headerNodeHandle->uiNodeHandle);
7576     return ERROR_CODE_NO_ERROR;
7577 }
7578 
SetListItemGroupFooter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7579 int32_t SetListItemGroupFooter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7580 {
7581     if (!item->object) {
7582         return ERROR_CODE_PARAM_INVALID;
7583     }
7584     auto fullImpl = GetFullImpl();
7585     auto footerNodeHandle = reinterpret_cast<ArkUI_NodeHandle>(item->object);
7586     fullImpl->getNodeModifiers()->getListItemGroupModifier()->listItemGroupSetFooter(
7587         node->uiNodeHandle, footerNodeHandle->uiNodeHandle);
7588     return ERROR_CODE_NO_ERROR;
7589 }
7590 
SetListItemGroupDivider(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7591 int32_t SetListItemGroupDivider(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7592 {
7593     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
7594     if (actualSize < 0 || LessNotEqual(item->value[NUM_1].f32, NUM_0) || LessNotEqual(item->value[NUM_2].f32, NUM_0) ||
7595         LessNotEqual(item->value[NUM_3].f32, NUM_0)) {
7596         return ERROR_CODE_PARAM_INVALID;
7597     }
7598     auto fullImpl = GetFullImpl();
7599     auto color = item->value[NUM_0].u32;
7600     int32_t unit = GetDefaultUnit(node, UNIT_VP);
7601     ArkUI_Float32 values[NUM_3] = { item->value[NUM_1].f32, item->value[NUM_2].f32, item->value[NUM_3].f32 };
7602     ArkUI_Int32 units[NUM_3] = { unit, unit, unit };
7603 
7604     fullImpl->getNodeModifiers()->getListItemGroupModifier()->listItemGroupSetDivider(
7605         node->uiNodeHandle, color, values, units, NUM_3);
7606     return ERROR_CODE_NO_ERROR;
7607 }
7608 
ResetListItemGroupDivider(ArkUI_NodeHandle node)7609 void ResetListItemGroupDivider(ArkUI_NodeHandle node)
7610 {
7611     // already check in entry point.
7612     auto* fullImpl = GetFullImpl();
7613     fullImpl->getNodeModifiers()->getListItemGroupModifier()->listItemGroupResetDivider(node->uiNodeHandle);
7614 }
7615 
GetListItemGroupDivider(ArkUI_NodeHandle node)7616 const ArkUI_AttributeItem* GetListItemGroupDivider(ArkUI_NodeHandle node)
7617 {
7618     ArkUIdividerOptions option;
7619     GetFullImpl()->getNodeModifiers()->getListItemGroupModifier()->getlistItemGroupDivider(
7620         node->uiNodeHandle, &option, GetDefaultUnit(node, UNIT_VP));
7621     g_numberValues[NUM_0].u32 = option.color;
7622     g_numberValues[NUM_1].f32 = option.strokeWidth;
7623     g_numberValues[NUM_2].f32 = option.startMargin;
7624     g_numberValues[NUM_3].f32 = option.endMargin;
7625     g_attributeItem.size = ALLOW_SIZE_4;
7626     return &g_attributeItem;
7627 }
7628 
SetListItemGroupChildrenMainSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7629 int32_t SetListItemGroupChildrenMainSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7630 {
7631     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
7632     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
7633     auto* listChildrenMainSize = reinterpret_cast<ArkUIListChildrenMainSize>(item->object);
7634     int32_t unit = GetDefaultUnit(node, UNIT_VP);
7635     GetFullImpl()->getNodeModifiers()->getListItemGroupModifier()->setListItemGroupChildrenMainSize(
7636         node->uiNodeHandle, listChildrenMainSize, unit);
7637     return ERROR_CODE_NO_ERROR;
7638 }
7639 
ResetListItemGroupChildrenMainSize(ArkUI_NodeHandle node)7640 void ResetListItemGroupChildrenMainSize(ArkUI_NodeHandle node)
7641 {
7642     auto* fullImpl = GetFullImpl();
7643     fullImpl->getNodeModifiers()->getListItemGroupModifier()->resetListItemGroupChildrenMainSize(node->uiNodeHandle);
7644 }
7645 
SetListItemSwiperAction(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7646 int32_t SetListItemSwiperAction(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7647 {
7648     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
7649     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
7650     auto* listItemSwipeActionOption = reinterpret_cast<ArkUIListItemSwipeActionOptionHandle>(item->object);
7651     GetFullImpl()->getNodeModifiers()->getListItemModifier()->setListItemSwipeAction(
7652         node->uiNodeHandle, listItemSwipeActionOption);
7653     return ERROR_CODE_NO_ERROR;
7654 }
7655 
ResetListItemSwiperAction(ArkUI_NodeHandle node)7656 void ResetListItemSwiperAction(ArkUI_NodeHandle node)
7657 {
7658     auto* fullImpl = GetFullImpl();
7659     fullImpl->getNodeModifiers()->getListItemModifier()->resetListItemSwipeAction(node->uiNodeHandle);
7660 }
7661 // datepicker
7662 
GetDatePickerLunar(ArkUI_NodeHandle node)7663 const ArkUI_AttributeItem* GetDatePickerLunar(ArkUI_NodeHandle node)
7664 {
7665     auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getLunar(node->uiNodeHandle);
7666     g_numberValues[0].i32 = value;
7667     return &g_attributeItem;
7668 }
7669 
SetDatePickerLunar(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7670 int32_t SetDatePickerLunar(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7671 {
7672     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7673     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
7674         return ERROR_CODE_PARAM_INVALID;
7675     }
7676     auto fullImpl = GetFullImpl();
7677     fullImpl->getNodeModifiers()->getDatePickerModifier()->setLunar(node->uiNodeHandle, item->value[NUM_0].i32);
7678     return ERROR_CODE_NO_ERROR;
7679 }
7680 
ResetDatePickerLunar(ArkUI_NodeHandle node)7681 void ResetDatePickerLunar(ArkUI_NodeHandle node)
7682 {
7683     auto fullImpl = GetFullImpl();
7684 
7685     fullImpl->getNodeModifiers()->getDatePickerModifier()->resetLunar(node->uiNodeHandle);
7686 }
7687 
GetDatePickerStart(ArkUI_NodeHandle node)7688 const ArkUI_AttributeItem* GetDatePickerStart(ArkUI_NodeHandle node)
7689 {
7690     auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getStartDate(node->uiNodeHandle);
7691     g_attributeItem.string = value;
7692     return &g_attributeItem;
7693 }
7694 
SetDatePickerStart(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7695 int32_t SetDatePickerStart(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7696 {
7697     if (!item->string) {
7698         return ERROR_CODE_PARAM_INVALID;
7699     }
7700     auto fullImpl = GetFullImpl();
7701     std::vector<std::string> date;
7702     StringUtils::StringSplitter(item->string, '-', date);
7703     if (date.size() != NUM_3) {
7704         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "date is invalid");
7705         return ERROR_CODE_PARAM_INVALID;
7706     }
7707 
7708     auto year = StringToInt(date[NUM_0].c_str(), DATEPICKER_START_TIME);
7709     auto month = StringToInt(date[NUM_1].c_str(), NUM_1);
7710     auto day = StringToInt(date[NUM_2].c_str(), NUM_1);
7711     fullImpl->getNodeModifiers()->getDatePickerModifier()->setStartDate(node->uiNodeHandle, year, month, day);
7712 
7713     return ERROR_CODE_NO_ERROR;
7714 }
7715 
ResetDatePickerStart(ArkUI_NodeHandle node)7716 void ResetDatePickerStart(ArkUI_NodeHandle node)
7717 {
7718     auto fullImpl = GetFullImpl();
7719 
7720     fullImpl->getNodeModifiers()->getDatePickerModifier()->resetStartDate(node->uiNodeHandle);
7721 }
7722 
GetDatePickerEnd(ArkUI_NodeHandle node)7723 const ArkUI_AttributeItem* GetDatePickerEnd(ArkUI_NodeHandle node)
7724 {
7725     auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getEndDate(node->uiNodeHandle);
7726     g_attributeItem.string = value;
7727     return &g_attributeItem;
7728 }
7729 
SetDatePickerEnd(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7730 int32_t SetDatePickerEnd(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7731 {
7732     if (!item->string) {
7733         return ERROR_CODE_PARAM_INVALID;
7734     }
7735     auto fullImpl = GetFullImpl();
7736     std::vector<std::string> date;
7737     StringUtils::StringSplitter(item->string, '-', date);
7738     if (date.size() != NUM_3) {
7739         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "date is invalid");
7740         return ERROR_CODE_PARAM_INVALID;
7741     }
7742 
7743     auto year = StringToInt(date[NUM_0].c_str(), DATEPICKER_END_TIME);
7744     auto month = StringToInt(date[NUM_1].c_str(), NUM_12);
7745     auto day = StringToInt(date[NUM_2].c_str(), NUM_31);
7746     fullImpl->getNodeModifiers()->getDatePickerModifier()->setEndDate(node->uiNodeHandle, year, month, day);
7747 
7748     return ERROR_CODE_NO_ERROR;
7749 }
7750 
ResetDatePickerEnd(ArkUI_NodeHandle node)7751 void ResetDatePickerEnd(ArkUI_NodeHandle node)
7752 {
7753     auto fullImpl = GetFullImpl();
7754 
7755     fullImpl->getNodeModifiers()->getDatePickerModifier()->resetEndDate(node->uiNodeHandle);
7756 }
7757 
GetDatePickerSelected(ArkUI_NodeHandle node)7758 const ArkUI_AttributeItem* GetDatePickerSelected(ArkUI_NodeHandle node)
7759 {
7760     auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getSelectedDate(node->uiNodeHandle);
7761     g_attributeItem.string = value;
7762     return &g_attributeItem;
7763 }
7764 
SetDatePickerSelected(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7765 int32_t SetDatePickerSelected(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7766 {
7767     if (!item->string) {
7768         return ERROR_CODE_PARAM_INVALID;
7769     }
7770     auto fullImpl = GetFullImpl();
7771     std::vector<std::string> date;
7772     StringUtils::StringSplitter(item->string, '-', date);
7773     if (date.size() != NUM_3) {
7774         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "date is invalid");
7775         return ERROR_CODE_PARAM_INVALID;
7776     }
7777 
7778     auto year = StringToInt(date[NUM_0].c_str());
7779     auto month = StringToInt(date[NUM_1].c_str());
7780     auto day = StringToInt(date[NUM_2].c_str());
7781     fullImpl->getNodeModifiers()->getDatePickerModifier()->setSelectedDate(node->uiNodeHandle, year, month, day);
7782 
7783     return ERROR_CODE_NO_ERROR;
7784 }
7785 
ResetDatePickerSelected(ArkUI_NodeHandle node)7786 void ResetDatePickerSelected(ArkUI_NodeHandle node)
7787 {
7788     auto fullImpl = GetFullImpl();
7789 
7790     fullImpl->getNodeModifiers()->getDatePickerModifier()->resetSelectedDate(node->uiNodeHandle);
7791 }
7792 
GetDatePickerDisappearTextStyle(ArkUI_NodeHandle node)7793 const ArkUI_AttributeItem* GetDatePickerDisappearTextStyle(ArkUI_NodeHandle node)
7794 {
7795     auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getDisappearTextStyle(node->uiNodeHandle);
7796     g_attributeItem.string = value;
7797     return &g_attributeItem;
7798 }
7799 
SetDatePickerDisappearTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7800 int32_t SetDatePickerDisappearTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7801 {
7802     if (!item->string) {
7803         return ERROR_CODE_PARAM_INVALID;
7804     }
7805     auto fullImpl = GetFullImpl();
7806     std::vector<std::string> params;
7807     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7808     if (params.size() != NUM_5) {
7809         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7810         return ERROR_CODE_PARAM_INVALID;
7811     }
7812 
7813     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
7814     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
7815     if (size == ERROR_CODE) {
7816         return ERROR_CODE_PARAM_INVALID;
7817     }
7818     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
7819     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
7820 
7821     fullImpl->getNodeModifiers()->getDatePickerModifier()->setDisappearTextStyle(
7822         node->uiNodeHandle, fontInfo.c_str(), color, style);
7823 
7824     return ERROR_CODE_NO_ERROR;
7825 }
7826 
ResetDatePickerDisappearTextStyle(ArkUI_NodeHandle node)7827 void ResetDatePickerDisappearTextStyle(ArkUI_NodeHandle node)
7828 {
7829     auto fullImpl = GetFullImpl();
7830 
7831     fullImpl->getNodeModifiers()->getDatePickerModifier()->resetDisappearTextStyle(node->uiNodeHandle);
7832 }
7833 
GetDatePickerTextStyle(ArkUI_NodeHandle node)7834 const ArkUI_AttributeItem* GetDatePickerTextStyle(ArkUI_NodeHandle node)
7835 {
7836     auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getDatePickerTextStyle(node->uiNodeHandle);
7837     g_attributeItem.string = value;
7838     return &g_attributeItem;
7839 }
7840 
SetDatePickerTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7841 int32_t SetDatePickerTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7842 {
7843     if (!item->string) {
7844         return ERROR_CODE_PARAM_INVALID;
7845     }
7846     auto fullImpl = GetFullImpl();
7847     std::vector<std::string> params;
7848     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7849     if (params.size() != NUM_5) {
7850         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7851         return ERROR_CODE_PARAM_INVALID;
7852     }
7853 
7854     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
7855     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
7856     if (size == ERROR_CODE) {
7857         return ERROR_CODE_PARAM_INVALID;
7858     }
7859     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
7860     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
7861 
7862     fullImpl->getNodeModifiers()->getDatePickerModifier()->setDatePickerTextStyle(
7863         node->uiNodeHandle, fontInfo.c_str(), color, style);
7864 
7865     return ERROR_CODE_NO_ERROR;
7866 }
7867 
ResetDatePickerTextStyle(ArkUI_NodeHandle node)7868 void ResetDatePickerTextStyle(ArkUI_NodeHandle node)
7869 {
7870     auto fullImpl = GetFullImpl();
7871 
7872     fullImpl->getNodeModifiers()->getDatePickerModifier()->resetDatePickerTextStyle(node->uiNodeHandle);
7873 }
7874 
GetDatePickerSelectedTextStyle(ArkUI_NodeHandle node)7875 const ArkUI_AttributeItem* GetDatePickerSelectedTextStyle(ArkUI_NodeHandle node)
7876 {
7877     auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getSelectedTextStyle(node->uiNodeHandle);
7878     g_attributeItem.string = value;
7879     return &g_attributeItem;
7880 }
7881 
SetDatePickerSelectedTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7882 int32_t SetDatePickerSelectedTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7883 {
7884     if (!item->string) {
7885         return ERROR_CODE_PARAM_INVALID;
7886     }
7887     auto fullImpl = GetFullImpl();
7888     std::vector<std::string> params;
7889     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7890     if (params.size() != NUM_5) {
7891         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7892         return ERROR_CODE_PARAM_INVALID;
7893     }
7894 
7895     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_SELECTED_COLOR);
7896     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
7897     if (size == ERROR_CODE) {
7898         return ERROR_CODE_PARAM_INVALID;
7899     }
7900     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
7901     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
7902 
7903     fullImpl->getNodeModifiers()->getDatePickerModifier()->setSelectedTextStyle(
7904         node->uiNodeHandle, fontInfo.c_str(), color, style);
7905 
7906     return ERROR_CODE_NO_ERROR;
7907 }
7908 
ResetDatePickerSelectedTextStyle(ArkUI_NodeHandle node)7909 void ResetDatePickerSelectedTextStyle(ArkUI_NodeHandle node)
7910 {
7911     auto fullImpl = GetFullImpl();
7912 
7913     fullImpl->getNodeModifiers()->getDatePickerModifier()->resetSelectedTextStyle(node->uiNodeHandle);
7914 }
7915 
7916 // timepicker
GetTimePickerSelected(ArkUI_NodeHandle node)7917 const ArkUI_AttributeItem* GetTimePickerSelected(ArkUI_NodeHandle node)
7918 {
7919     auto value = GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerSelected(node->uiNodeHandle);
7920     g_attributeItem.string = value;
7921     return &g_attributeItem;
7922 }
7923 
SetTimePickerSelected(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7924 int32_t SetTimePickerSelected(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7925 {
7926     if (!item->string) {
7927         return ERROR_CODE_PARAM_INVALID;
7928     }
7929     auto fullImpl = GetFullImpl();
7930     std::vector<std::string> time;
7931     StringUtils::StringSplitter(item->string, '-', time);
7932     if (time.size() != NUM_2) {
7933         return ERROR_CODE_PARAM_INVALID;
7934     }
7935 
7936     auto hour = StringToInt(time[NUM_0].c_str());
7937     auto minute = StringToInt(time[NUM_1].c_str());
7938     if (!InRegion(NUM_0, NUM_23, hour) || !InRegion(NUM_0, NUM_59, minute)) {
7939         return ERROR_CODE_PARAM_INVALID;
7940     }
7941     fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerSelected(node->uiNodeHandle, hour, minute);
7942 
7943     return ERROR_CODE_NO_ERROR;
7944 }
7945 
ResetTimePickerSelected(ArkUI_NodeHandle node)7946 void ResetTimePickerSelected(ArkUI_NodeHandle node)
7947 {
7948     auto fullImpl = GetFullImpl();
7949 
7950     fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerSelected(node->uiNodeHandle);
7951 }
7952 
GetTimePickerUseMilitaryTime(ArkUI_NodeHandle node)7953 const ArkUI_AttributeItem* GetTimePickerUseMilitaryTime(ArkUI_NodeHandle node)
7954 {
7955     auto value =
7956         GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerUseMilitaryTime(node->uiNodeHandle);
7957     g_numberValues[0].i32 = value;
7958     return &g_attributeItem;
7959 }
7960 
SetTimePickerUseMilitaryTime(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7961 int32_t SetTimePickerUseMilitaryTime(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7962 {
7963     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7964     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
7965         return ERROR_CODE_PARAM_INVALID;
7966     }
7967     auto fullImpl = GetFullImpl();
7968     fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerUseMilitaryTime(
7969         node->uiNodeHandle, item->value[NUM_0].i32);
7970 
7971     return ERROR_CODE_NO_ERROR;
7972 }
7973 
ResetTimePickerUseMilitaryTime(ArkUI_NodeHandle node)7974 void ResetTimePickerUseMilitaryTime(ArkUI_NodeHandle node)
7975 {
7976     auto fullImpl = GetFullImpl();
7977 
7978     fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerUseMilitaryTime(node->uiNodeHandle);
7979 }
7980 
GetTimePickerDisappearTextStyle(ArkUI_NodeHandle node)7981 const ArkUI_AttributeItem* GetTimePickerDisappearTextStyle(ArkUI_NodeHandle node)
7982 {
7983     auto value =
7984         GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerDisappearTextStyle(node->uiNodeHandle);
7985     g_attributeItem.string = value;
7986     return &g_attributeItem;
7987 }
7988 
SetTimePickerDisappearTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7989 int32_t SetTimePickerDisappearTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7990 {
7991     if (!item->string) {
7992         return ERROR_CODE_PARAM_INVALID;
7993     }
7994     auto fullImpl = GetFullImpl();
7995     std::vector<std::string> params;
7996     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7997     if (params.size() != NUM_5) {
7998         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7999         return ERROR_CODE_PARAM_INVALID;
8000     }
8001 
8002     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
8003     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8004     if (size == ERROR_CODE) {
8005         return ERROR_CODE_PARAM_INVALID;
8006     }
8007     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8008     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8009 
8010     fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerDisappearTextStyle(
8011         node->uiNodeHandle, color, fontInfo.c_str(), style);
8012 
8013     return ERROR_CODE_NO_ERROR;
8014 }
8015 
ResetTimePickerDisappearTextStyle(ArkUI_NodeHandle node)8016 void ResetTimePickerDisappearTextStyle(ArkUI_NodeHandle node)
8017 {
8018     auto fullImpl = GetFullImpl();
8019 
8020     fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerDisappearTextStyle(node->uiNodeHandle);
8021 }
8022 
GetTimePickerTextStyle(ArkUI_NodeHandle node)8023 const ArkUI_AttributeItem* GetTimePickerTextStyle(ArkUI_NodeHandle node)
8024 {
8025     auto value =
8026         GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerTextStyle(node->uiNodeHandle);
8027     g_attributeItem.string = value;
8028     return &g_attributeItem;
8029 }
8030 
SetTimePickerTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8031 int32_t SetTimePickerTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8032 {
8033     if (!item->string) {
8034         return ERROR_CODE_PARAM_INVALID;
8035     }
8036     auto fullImpl = GetFullImpl();
8037     std::vector<std::string> params;
8038     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8039     if (params.size() != NUM_5) {
8040         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8041         return ERROR_CODE_PARAM_INVALID;
8042     }
8043     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
8044     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8045     if (size == ERROR_CODE) {
8046         return ERROR_CODE_PARAM_INVALID;
8047     }
8048     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8049     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8050 
8051     fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerTextStyle(
8052         node->uiNodeHandle, color, fontInfo.c_str(), style);
8053 
8054     return ERROR_CODE_NO_ERROR;
8055 }
8056 
ResetTimePickerTextStyle(ArkUI_NodeHandle node)8057 void ResetTimePickerTextStyle(ArkUI_NodeHandle node)
8058 {
8059     auto fullImpl = GetFullImpl();
8060 
8061     fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerTextStyle(node->uiNodeHandle);
8062 }
8063 
GetTimePickerSelectedTextStyle(ArkUI_NodeHandle node)8064 const ArkUI_AttributeItem* GetTimePickerSelectedTextStyle(ArkUI_NodeHandle node)
8065 {
8066     auto value =
8067         GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerSelectedTextStyle(node->uiNodeHandle);
8068     g_attributeItem.string = value;
8069     return &g_attributeItem;
8070 }
8071 
SetTimePickerSelectedTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8072 int32_t SetTimePickerSelectedTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8073 {
8074     if (!item->string) {
8075         return ERROR_CODE_PARAM_INVALID;
8076     }
8077     auto fullImpl = GetFullImpl();
8078     std::vector<std::string> params;
8079     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8080     if (params.size() != NUM_5) {
8081         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8082         return ERROR_CODE_PARAM_INVALID;
8083     }
8084 
8085     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_SELECTED_COLOR);
8086     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8087     if (size == ERROR_CODE) {
8088         return ERROR_CODE_PARAM_INVALID;
8089     }
8090     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8091     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8092     fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerSelectedTextStyle(
8093         node->uiNodeHandle, color, fontInfo.c_str(), style);
8094 
8095     return ERROR_CODE_NO_ERROR;
8096 }
8097 
ResetTimePickerSelectedTextStyle(ArkUI_NodeHandle node)8098 void ResetTimePickerSelectedTextStyle(ArkUI_NodeHandle node)
8099 {
8100     auto fullImpl = GetFullImpl();
8101 
8102     fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerSelectedTextStyle(node->uiNodeHandle);
8103 }
8104 
8105 // TextPicker
GetTextPickerDisappearTextStyle(ArkUI_NodeHandle node)8106 const ArkUI_AttributeItem* GetTextPickerDisappearTextStyle(ArkUI_NodeHandle node)
8107 {
8108     auto value =
8109         GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerDisappearTextStyle(node->uiNodeHandle);
8110     g_attributeItem.string = value;
8111     return &g_attributeItem;
8112 }
8113 
SetTextPickerDisappearTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8114 int32_t SetTextPickerDisappearTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8115 {
8116     if (!item->string) {
8117         return ERROR_CODE_PARAM_INVALID;
8118     }
8119     auto fullImpl = GetFullImpl();
8120     std::vector<std::string> params;
8121     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8122     if (params.size() != NUM_5) {
8123         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8124         return ERROR_CODE_PARAM_INVALID;
8125     }
8126 
8127     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
8128     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8129     if (size == ERROR_CODE) {
8130         return ERROR_CODE_PARAM_INVALID;
8131     }
8132     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8133     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8134 
8135     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerDisappearTextStyle(
8136         node->uiNodeHandle, color, fontInfo.c_str(), style);
8137 
8138     return ERROR_CODE_NO_ERROR;
8139 }
8140 
ResetTextPickerDisappearTextStyle(ArkUI_NodeHandle node)8141 void ResetTextPickerDisappearTextStyle(ArkUI_NodeHandle node)
8142 {
8143     auto fullImpl = GetFullImpl();
8144 
8145     fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerDisappearTextStyle(node->uiNodeHandle);
8146 }
8147 
GetTextPickerTextStyle(ArkUI_NodeHandle node)8148 const ArkUI_AttributeItem* GetTextPickerTextStyle(ArkUI_NodeHandle node)
8149 {
8150     auto value =
8151         GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerTextStyle(node->uiNodeHandle);
8152     g_attributeItem.string = value;
8153     return &g_attributeItem;
8154 }
8155 
SetTextPickerTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8156 int32_t SetTextPickerTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8157 {
8158     if (!item->string) {
8159         return ERROR_CODE_PARAM_INVALID;
8160     }
8161     auto fullImpl = GetFullImpl();
8162     std::vector<std::string> params;
8163     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8164     if (params.size() != NUM_5) {
8165         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8166         return ERROR_CODE_PARAM_INVALID;
8167     }
8168 
8169     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
8170     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8171     if (size == ERROR_CODE) {
8172         return ERROR_CODE_PARAM_INVALID;
8173     }
8174     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8175     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8176 
8177     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerTextStyle(
8178         node->uiNodeHandle, color, fontInfo.c_str(), style);
8179 
8180     return ERROR_CODE_NO_ERROR;
8181 }
8182 
ResetTextPickerTextStyle(ArkUI_NodeHandle node)8183 void ResetTextPickerTextStyle(ArkUI_NodeHandle node)
8184 {
8185     auto fullImpl = GetFullImpl();
8186 
8187     fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerTextStyle(node->uiNodeHandle);
8188 }
8189 
GetTextPickerSelectedTextStyle(ArkUI_NodeHandle node)8190 const ArkUI_AttributeItem* GetTextPickerSelectedTextStyle(ArkUI_NodeHandle node)
8191 {
8192     auto value =
8193         GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedTextStyle(node->uiNodeHandle);
8194     g_attributeItem.string = value;
8195     return &g_attributeItem;
8196 }
8197 
SetTextPickerSelectedTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8198 int32_t SetTextPickerSelectedTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8199 {
8200     if (!item->string) {
8201         return ERROR_CODE_PARAM_INVALID;
8202     }
8203     auto fullImpl = GetFullImpl();
8204     std::vector<std::string> params;
8205     StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8206     if (params.size() != NUM_5) {
8207         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8208         return ERROR_CODE_PARAM_INVALID;
8209     }
8210 
8211     ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_SELECTED_COLOR);
8212     int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8213     if (size == ERROR_CODE) {
8214         return ERROR_CODE_PARAM_INVALID;
8215     }
8216     auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8217     std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8218 
8219     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerSelectedTextStyle(
8220         node->uiNodeHandle, color, fontInfo.c_str(), style);
8221 
8222     return ERROR_CODE_NO_ERROR;
8223 }
8224 
ResetTextPickerSelectedTextStyle(ArkUI_NodeHandle node)8225 void ResetTextPickerSelectedTextStyle(ArkUI_NodeHandle node)
8226 {
8227     auto fullImpl = GetFullImpl();
8228 
8229     fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerSelectedTextStyle(node->uiNodeHandle);
8230 }
8231 
GetTextPickerSelectedIndex(ArkUI_NodeHandle node)8232 const ArkUI_AttributeItem* GetTextPickerSelectedIndex(ArkUI_NodeHandle node)
8233 {
8234     int32_t size = GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedSize(
8235         node->uiNodeHandle);
8236     ArkUI_Uint32 values[size];
8237     GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedIndex(
8238         node->uiNodeHandle, values, size);
8239     for (int i = 0; i < size; ++i) {
8240         g_numberValues[i].i32 = static_cast<int32_t>(values[i]);
8241     }
8242     return &g_attributeItem;
8243 }
8244 
SetTextPickerSelectedIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8245 int32_t SetTextPickerSelectedIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8246 {
8247     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8248     if (actualSize < 0 || LessNotEqual(item->value[0].i32, NUM_0)) {
8249         return ERROR_CODE_PARAM_INVALID;
8250     }
8251     auto fullImpl = GetFullImpl();
8252     ArkUI_Uint32 values[item->size];
8253     for (int i = 0; i < item->size; ++i) {
8254         values[i] = item->value[i].i32;
8255     }
8256     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerSelectedIndex(
8257         node->uiNodeHandle, values, item->size);
8258     return ERROR_CODE_NO_ERROR;
8259 }
8260 
ResetTextPickerSelectedIndex(ArkUI_NodeHandle node)8261 void ResetTextPickerSelectedIndex(ArkUI_NodeHandle node)
8262 {
8263     auto fullImpl = GetFullImpl();
8264 
8265     fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerSelectedIndex(node->uiNodeHandle);
8266 }
8267 
SetTextPickerRange(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8268 int32_t SetTextPickerRange(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8269 {
8270     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8271     if (actualSize < 0 || !InRegion(static_cast<int32_t>(ARKUI_TEXTPICKER_RANGETYPE_SINGLE),
8272         static_cast<int32_t>(ARKUI_TEXTPICKER_RANGETYPE_MULTI), item->value[NUM_0].i32)) {
8273         return ERROR_CODE_PARAM_INVALID;
8274     }
8275     bool isSingleRange = false;
8276     auto fullImpl = GetFullImpl();
8277     if (!item->string) {
8278         return ERROR_CODE_PARAM_INVALID;
8279     }
8280     isSingleRange = item->value[NUM_0].i32 == static_cast<int32_t>(ARKUI_TEXTPICKER_RANGETYPE_SINGLE);
8281     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerRangeStr(
8282         node->uiNodeHandle, item->string, isSingleRange, item->value[NUM_0].i32);
8283     return ERROR_CODE_NO_ERROR;
8284 }
8285 
ResetTextPickerRange(ArkUI_NodeHandle node)8286 void ResetTextPickerRange(ArkUI_NodeHandle node)
8287 {
8288     auto fullImpl = GetFullImpl();
8289     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerRangeStr(node->uiNodeHandle, "", true, NUM_0);
8290 }
8291 
GetTextPickerRange(ArkUI_NodeHandle node)8292 const ArkUI_AttributeItem* GetTextPickerRange(ArkUI_NodeHandle node)
8293 {
8294     auto fullImpl = GetFullImpl();
8295     auto value =
8296         fullImpl->getNodeModifiers()->getTextPickerModifier()->getTextPickerRangeStr(node->uiNodeHandle);
8297     g_numberValues[0].i32 =
8298         fullImpl->getNodeModifiers()->getTextPickerModifier()->getTextPickerSingleRange(node->uiNodeHandle);
8299     g_attributeItem.string = value;
8300     return &g_attributeItem;
8301 }
8302 
SetTextPickerValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8303 int32_t SetTextPickerValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8304 {
8305     if (!item->string) {
8306         return ERROR_CODE_PARAM_INVALID;
8307     }
8308     auto fullImpl = GetFullImpl();
8309     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerValue(
8310         node->uiNodeHandle, item->string);
8311 
8312     return ERROR_CODE_NO_ERROR;
8313 }
8314 
ResetTextPickerValue(ArkUI_NodeHandle node)8315 void ResetTextPickerValue(ArkUI_NodeHandle node)
8316 {
8317     auto fullImpl = GetFullImpl();
8318 
8319     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerValue(node->uiNodeHandle, "");
8320 }
8321 
GetTextPickerValue(ArkUI_NodeHandle node)8322 const ArkUI_AttributeItem* GetTextPickerValue(ArkUI_NodeHandle node)
8323 {
8324     auto value =
8325         GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerValue(node->uiNodeHandle);
8326     g_attributeItem.string = value;
8327     return &g_attributeItem;
8328 }
8329 
GetTextPickerSelected(ArkUI_NodeHandle node)8330 const ArkUI_AttributeItem* GetTextPickerSelected(ArkUI_NodeHandle node)
8331 {
8332     int32_t size = GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedSize(
8333         node->uiNodeHandle);
8334     ArkUI_Uint32 values[size];
8335     GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedIndex(
8336         node->uiNodeHandle, values, size);
8337     for (int i = 0; i < size; ++i) {
8338         g_numberValues[i].u32 = values[i];
8339     }
8340     return &g_attributeItem;
8341 }
8342 
SetTextPickerSelected(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8343 int32_t SetTextPickerSelected(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8344 {
8345     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8346     if (actualSize < 0 || LessNotEqual(item->value[0].u32, NUM_0)) {
8347         return ERROR_CODE_PARAM_INVALID;
8348     }
8349     auto fullImpl = GetFullImpl();
8350     ArkUI_Uint32 values[item->size];
8351     for (int i = 0; i < item->size; ++i) {
8352         values[i] = item->value[i].u32;
8353     }
8354     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerSelectedIndex(
8355         node->uiNodeHandle, values, item->size);
8356     return ERROR_CODE_NO_ERROR;
8357 }
8358 
SetTextPickerCanLoop(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8359 int32_t SetTextPickerCanLoop(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8360 {
8361     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8362     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
8363         return ERROR_CODE_PARAM_INVALID;
8364     }
8365     auto fullImpl = GetFullImpl();
8366     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerCanLoop(
8367         node->uiNodeHandle, item->value[0].i32);
8368     return ERROR_CODE_NO_ERROR;
8369 }
8370 
GetTextPickerCanLoop(ArkUI_NodeHandle node)8371 const ArkUI_AttributeItem* GetTextPickerCanLoop(ArkUI_NodeHandle node)
8372 {
8373     int32_t result = GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerCanLoop(
8374         node->uiNodeHandle);
8375     g_numberValues[0].i32 = result;
8376     return &g_attributeItem;
8377 }
8378 
ResetTextPickerCanLoop(ArkUI_NodeHandle node)8379 void ResetTextPickerCanLoop(ArkUI_NodeHandle node)
8380 {
8381     auto fullImpl = GetFullImpl();
8382     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerCanLoop(
8383         node->uiNodeHandle, true);
8384 }
8385 
SetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8386 int32_t SetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8387 {
8388     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8389     if (actualSize < 0 || LessNotEqual(item->value[0].f32, NUM_0)) {
8390         return ERROR_CODE_PARAM_INVALID;
8391     }
8392     auto fullImpl = GetFullImpl();
8393     int32_t unit = GetDefaultUnit(node, UNIT_VP);
8394     fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerDefaultPickerItemHeight(
8395         node->uiNodeHandle, item->value[0].f32, unit);
8396     return ERROR_CODE_NO_ERROR;
8397 }
8398 
GetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node)8399 const ArkUI_AttributeItem* GetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node)
8400 {
8401     int32_t unit = GetDefaultUnit(node, UNIT_VP);
8402     float result = GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerDefaultPickerItemHeight(
8403         node->uiNodeHandle, unit);
8404     g_numberValues[0].f32 = result;
8405     return &g_attributeItem;
8406 }
8407 
ResetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node)8408 void ResetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node)
8409 {
8410     auto fullImpl = GetFullImpl();
8411     fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerDefaultPickerItemHeight(node->uiNodeHandle);
8412 }
8413 
8414 // Row&Column
SetAlignItems(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8415 int32_t SetAlignItems(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8416 {
8417     if (item->size == 0 || !InRegion(NUM_0, NUM_2, item->value[0].i32)) {
8418         return ERROR_CODE_PARAM_INVALID;
8419     }
8420     auto* fullImpl = GetFullImpl();
8421     switch (node->type) {
8422         case ARKUI_NODE_COLUMN:
8423             fullImpl->getNodeModifiers()->getColumnModifier()->setColumnAlignItems(
8424                 node->uiNodeHandle, item->value[0].i32 + NUM_1);
8425             break;
8426         case ARKUI_NODE_ROW:
8427             fullImpl->getNodeModifiers()->getRowModifier()->setRowAlignItems(
8428                 node->uiNodeHandle, item->value[0].i32 + NUM_1);
8429             break;
8430         default:
8431             break;
8432     }
8433     return ERROR_CODE_NO_ERROR;
8434 }
8435 
ResetAlignItems(ArkUI_NodeHandle node)8436 void ResetAlignItems(ArkUI_NodeHandle node)
8437 {
8438     auto* fullImpl = GetFullImpl();
8439     switch (node->type) {
8440         case ARKUI_NODE_COLUMN:
8441             fullImpl->getNodeModifiers()->getColumnModifier()->resetColumnAlignItems(node->uiNodeHandle);
8442             break;
8443         case ARKUI_NODE_ROW:
8444             fullImpl->getNodeModifiers()->getRowModifier()->resetRowAlignItems(node->uiNodeHandle);
8445             break;
8446         default:
8447             break;
8448     }
8449 }
8450 
GetAlignItems(ArkUI_NodeHandle node)8451 const ArkUI_AttributeItem* GetAlignItems(ArkUI_NodeHandle node)
8452 {
8453     auto fullImpl = GetFullImpl();
8454     switch (node->type) {
8455         case ARKUI_NODE_COLUMN:
8456             g_numberValues[0].i32 =
8457                 fullImpl->getNodeModifiers()->getColumnModifier()->getColumnAlignItems(node->uiNodeHandle) - NUM_1;
8458             break;
8459         case ARKUI_NODE_ROW:
8460             g_numberValues[0].i32 =
8461                 fullImpl->getNodeModifiers()->getRowModifier()->getRowAlignItems(node->uiNodeHandle) - NUM_1;
8462             break;
8463         default:
8464             break;
8465     }
8466     return &g_attributeItem;
8467 }
8468 
SetJustifyContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8469 int32_t SetJustifyContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8470 {
8471     if (item->size == 0 || !InRegion(NUM_1, NUM_8, item->value[0].i32)) {
8472         return ERROR_CODE_PARAM_INVALID;
8473     }
8474     auto* fullImpl = GetFullImpl();
8475     switch (node->type) {
8476         case ARKUI_NODE_COLUMN:
8477             fullImpl->getNodeModifiers()->getColumnModifier()->setColumnJustifyContent(
8478                 node->uiNodeHandle, item->value[0].i32);
8479             break;
8480         case ARKUI_NODE_ROW:
8481             fullImpl->getNodeModifiers()->getRowModifier()->setRowJustifyContent(
8482                 node->uiNodeHandle, item->value[0].i32);
8483             break;
8484         default:
8485             break;
8486     }
8487     return ERROR_CODE_NO_ERROR;
8488 }
8489 
ResetJustifyContent(ArkUI_NodeHandle node)8490 void ResetJustifyContent(ArkUI_NodeHandle node)
8491 {
8492     auto* fullImpl = GetFullImpl();
8493     switch (node->type) {
8494         case ARKUI_NODE_COLUMN:
8495             fullImpl->getNodeModifiers()->getColumnModifier()->resetColumnJustifyContent(node->uiNodeHandle);
8496             break;
8497         case ARKUI_NODE_ROW:
8498             fullImpl->getNodeModifiers()->getRowModifier()->resetRowJustifyContent(node->uiNodeHandle);
8499             break;
8500         default:
8501             break;
8502     }
8503 }
8504 
GetJustifyContent(ArkUI_NodeHandle node)8505 const ArkUI_AttributeItem* GetJustifyContent(ArkUI_NodeHandle node)
8506 {
8507     auto* fullImpl = GetFullImpl();
8508     switch (node->type) {
8509         case ARKUI_NODE_COLUMN:
8510             g_numberValues[0].i32 =
8511                 fullImpl->getNodeModifiers()->getColumnModifier()->getColumnJustifyContent(node->uiNodeHandle);
8512             break;
8513         case ARKUI_NODE_ROW:
8514             g_numberValues[0].i32 =
8515                 fullImpl->getNodeModifiers()->getRowModifier()->getRowJustifyContent(node->uiNodeHandle);
8516             break;
8517         default:
8518             break;
8519     }
8520     return &g_attributeItem;
8521 }
8522 
8523 // Flex
SetFlexOptions(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8524 int32_t SetFlexOptions(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8525 {
8526     if (item->size == 0) {
8527         return ERROR_CODE_PARAM_INVALID;
8528     }
8529     auto* fullImpl = GetFullImpl();
8530     int options[NUM_5] = { 0, 0, 0, 1, 0 };
8531     if (item->size > NUM_0) {
8532         if (!InRegion(NUM_0, NUM_3, item->value[NUM_0].i32)) {
8533             return ERROR_CODE_PARAM_INVALID;
8534         }
8535         options[NUM_0] = item->value[NUM_0].i32;
8536     }
8537     if (item->size > NUM_1) {
8538         if (!InRegion(NUM_0, NUM_2, item->value[NUM_1].i32)) {
8539             return ERROR_CODE_PARAM_INVALID;
8540         }
8541         options[NUM_1] = item->value[NUM_1].i32;
8542     }
8543     if (item->size > NUM_2) {
8544         if (!InRegion(NUM_1, NUM_8, item->value[NUM_2].i32)) {
8545             return ERROR_CODE_PARAM_INVALID;
8546         }
8547         options[NUM_2] = item->value[NUM_2].i32;
8548     }
8549     if (item->size > NUM_3) {
8550         if (!InRegion(NUM_0, NUM_5, item->value[NUM_3].i32)) {
8551             return ERROR_CODE_PARAM_INVALID;
8552         }
8553         options[NUM_3] = item->value[NUM_3].i32;
8554     }
8555     if (item->size > NUM_4) {
8556         if (!InRegion(NUM_1, NUM_8, item->value[NUM_4].i32)) {
8557             return ERROR_CODE_PARAM_INVALID;
8558         }
8559         options[NUM_4] = item->value[NUM_4].i32;
8560     }
8561     fullImpl->getNodeModifiers()->getFlexModifier()->setFlexOptions(node->uiNodeHandle, options, NUM_5);
8562     return ERROR_CODE_NO_ERROR;
8563 }
8564 
ResetFlexOptions(ArkUI_NodeHandle node)8565 void ResetFlexOptions(ArkUI_NodeHandle node)
8566 {
8567     auto* fullImpl = GetFullImpl();
8568     fullImpl->getNodeModifiers()->getFlexModifier()->resetFlexOptions(node->uiNodeHandle);
8569 }
8570 
GetFlexOptions(ArkUI_NodeHandle node)8571 const ArkUI_AttributeItem* GetFlexOptions(ArkUI_NodeHandle node)
8572 {
8573     ArkUIFlexOptions options;
8574     GetFullImpl()->getNodeModifiers()->getFlexModifier()->getFlexOptions(node->uiNodeHandle, &options);
8575     g_numberValues[NUM_0].i32 = options.direction;
8576     g_numberValues[NUM_1].i32 = options.wrap;
8577     g_numberValues[NUM_2].i32 = options.justifyContent;
8578     g_numberValues[NUM_3].i32 = options.alignItems;
8579     g_numberValues[NUM_4].i32 = options.alignContent;
8580     return &g_attributeItem;
8581 }
8582 
SetBackgroundImageSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8583 int32_t SetBackgroundImageSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8584 {
8585     auto* fullImpl = GetFullImpl();
8586     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
8587     if (actualSize < 0) {
8588         return ERROR_CODE_PARAM_INVALID;
8589     }
8590     if (LessNotEqual(item->value[BACKGROUND_IMAGE_WIDTH_INDEX].f32, 0.0f) ||
8591         LessNotEqual(item->value[BACKGROUND_IMAGE_HEIGHT_INDEX].f32, 0.0f)) {
8592         return ERROR_CODE_PARAM_INVALID;
8593     }
8594     fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImageSizeWithUnit(node->uiNodeHandle,
8595         item->value[BACKGROUND_IMAGE_WIDTH_INDEX].f32, item->value[BACKGROUND_IMAGE_HEIGHT_INDEX].f32,
8596         GetDefaultUnit(node, UNIT_VP));
8597     return ERROR_CODE_NO_ERROR;
8598 }
8599 
GetBackgroundImageSizeType(ArkUI_ImageSize nativeImageSizeType)8600 int32_t GetBackgroundImageSizeType(ArkUI_ImageSize nativeImageSizeType)
8601 {
8602     switch (nativeImageSizeType) {
8603         case ARKUI_IMAGE_SIZE_AUTO:
8604             return IMAGE_SIZE_TYPE_AUTO_INDEX;
8605         case ARKUI_IMAGE_SIZE_COVER:
8606             return IMAGE_SIZE_TYPE_COVER_INDEX;
8607         case ARKUI_IMAGE_SIZE_CONTAIN:
8608             return IMAGE_SIZE_TYPE_CONTAIN_INDEX;
8609         default:
8610             break;
8611     }
8612     return IMAGE_SIZE_TYPE_AUTO_INDEX;
8613 }
8614 
SetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8615 int32_t SetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8616 {
8617     auto* fullImpl = GetFullImpl();
8618     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8619     if (actualSize < 0 || item->value[0].i32 < 0 ||
8620         item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_SIZE_CONTAIN)) {
8621         return ERROR_CODE_PARAM_INVALID;
8622     }
8623     auto imageSizeType = GetBackgroundImageSizeType(static_cast<ArkUI_ImageSize>(item->value[0].i32));
8624     fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImageSize(
8625         node->uiNodeHandle, 0.0f, 0.0f, imageSizeType, imageSizeType);
8626     return ERROR_CODE_NO_ERROR;
8627 }
8628 
CheckBackgroundBlurStyleInput(const ArkUI_AttributeItem * item,int32_t size)8629 bool CheckBackgroundBlurStyleInput(const ArkUI_AttributeItem* item, int32_t size)
8630 {
8631     CHECK_NULL_RETURN(item, false);
8632     if (BLUR_STYLE_INDEX < size &&
8633         (item->value[BLUR_STYLE_INDEX].i32 < 0 ||
8634             item->value[BLUR_STYLE_INDEX].i32 > static_cast<int32_t>(ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK))) {
8635         return false;
8636     }
8637     if (COLOR_MODE_INDEX < size &&
8638         (item->value[COLOR_MODE_INDEX].i32 < 0 ||
8639             item->value[COLOR_MODE_INDEX].i32 > static_cast<int32_t>(ARKUI_COLOR_MODE_DARK))) {
8640         return false;
8641     }
8642     if (ADAPTIVE_COLOR_INDEX < size &&
8643         (item->value[ADAPTIVE_COLOR_INDEX].i32 < 0 ||
8644             item->value[ADAPTIVE_COLOR_INDEX].i32 > static_cast<int32_t>(ARKUI_ADAPTIVE_COLOR_AVERAGE))) {
8645         return false;
8646     }
8647     if (SCALE_INDEX < size &&
8648         (LessNotEqual(item->value[SCALE_INDEX].f32, 0.0f) || GreatNotEqual(item->value[SCALE_INDEX].f32, 1.0f))) {
8649         return false;
8650     }
8651     if (GRAY_SCALE_START < size &&
8652         (LessNotEqual(item->value[GRAY_SCALE_START].f32, 0.0f) ||
8653         GreatNotEqual(item->value[GRAY_SCALE_START].f32, MAX_GRAYSCALE))) {
8654         return false;
8655     }
8656     if (GRAY_SCALE_END < size &&
8657         (LessNotEqual(item->value[GRAY_SCALE_END].f32, 0.0f) ||
8658         GreatNotEqual(item->value[GRAY_SCALE_END].f32, MAX_GRAYSCALE))) {
8659         return false;
8660     }
8661     return true;
8662 }
8663 
SetBackgroundBlurStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8664 int32_t SetBackgroundBlurStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8665 {
8666     auto* fullImpl = GetFullImpl();
8667     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8668     if (actualSize < 0) {
8669         return ERROR_CODE_PARAM_INVALID;
8670     }
8671     auto isInputValid = CheckBackgroundBlurStyleInput(item, actualSize);
8672     if (!isInputValid) {
8673         return ERROR_CODE_PARAM_INVALID;
8674     }
8675     int32_t blurStyle = ARKUI_BLUR_STYLE_THIN;
8676     if (BLUR_STYLE_INDEX < actualSize) {
8677         blurStyle = ConvertBlurStyle(item->value[BLUR_STYLE_INDEX].i32);
8678     }
8679     int32_t colorMode = ARKUI_COLOR_MODE_SYSTEM;
8680     if (COLOR_MODE_INDEX < actualSize) {
8681         colorMode = item->value[COLOR_MODE_INDEX].i32;
8682     }
8683     int32_t adaptiveColor = ARKUI_ADAPTIVE_COLOR_DEFAULT;
8684     if (ADAPTIVE_COLOR_INDEX < actualSize) {
8685         adaptiveColor = item->value[ADAPTIVE_COLOR_INDEX].i32;
8686     }
8687     float scale = 1.0f;
8688     if (SCALE_INDEX < actualSize) {
8689         scale = item->value[SCALE_INDEX].f32;
8690     }
8691     uint32_t grayScaleStart = 0;
8692     if (GRAY_SCALE_START < actualSize) {
8693         if (GreatOrEqual(item->value[GRAY_SCALE_START].f32, 0.0f)) {
8694             grayScaleStart = static_cast<uint32_t>(item->value[GRAY_SCALE_START].f32);
8695         } else {
8696             return ERROR_CODE_PARAM_INVALID;
8697         }
8698     }
8699     uint32_t grayScaleEnd = 0;
8700     if (GRAY_SCALE_END < actualSize) {
8701         if (GreatOrEqual(item->value[GRAY_SCALE_END].f32, 0.0f)
8702             && GreatOrEqual(item->value[GRAY_SCALE_END].f32, item->value[GRAY_SCALE_START].f32)) {
8703             grayScaleEnd = static_cast<uint32_t>(item->value[GRAY_SCALE_END].f32);
8704         } else {
8705             return ERROR_CODE_PARAM_INVALID;
8706         }
8707     }
8708     int32_t intArray[NUM_5];
8709     intArray[NUM_0] = blurStyle;
8710     intArray[NUM_1] = colorMode;
8711     intArray[NUM_2] = adaptiveColor;
8712     std::vector<float> greyVector(NUM_2);
8713     greyVector[NUM_0] = grayScaleStart;
8714     greyVector[NUM_1] = grayScaleEnd;
8715     bool isValidColor = false;
8716     Color inactiveColor = Color::TRANSPARENT;
8717     fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundBlurStyle(
8718         node->uiNodeHandle, &intArray, scale, &greyVector[0], NUM_2, isValidColor, inactiveColor.GetValue());
8719     return ERROR_CODE_NO_ERROR;
8720 }
8721 
SetForegroundBlurStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8722 int32_t SetForegroundBlurStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8723 {
8724     auto* fullImpl = GetFullImpl();
8725     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8726     if (actualSize < 0 || !CheckBackgroundBlurStyleInput(item, actualSize)) {
8727         return ERROR_CODE_PARAM_INVALID;
8728     }
8729     int32_t blurStyle = ARKUI_BLUR_STYLE_THIN;
8730     if (BLUR_STYLE_INDEX < actualSize) {
8731         blurStyle = ConvertBlurStyle(item->value[BLUR_STYLE_INDEX].i32);
8732     }
8733     int32_t colorMode = ARKUI_COLOR_MODE_SYSTEM;
8734     if (COLOR_MODE_INDEX < actualSize) {
8735         colorMode = item->value[COLOR_MODE_INDEX].i32;
8736     }
8737     int32_t adaptiveColor = ARKUI_ADAPTIVE_COLOR_DEFAULT;
8738     if (ADAPTIVE_COLOR_INDEX < actualSize) {
8739         adaptiveColor = item->value[ADAPTIVE_COLOR_INDEX].i32;
8740     }
8741     float scale = 1.0f;
8742     if (SCALE_INDEX < actualSize) {
8743         scale = item->value[SCALE_INDEX].f32;
8744     }
8745     float grayScaleStart = 0;
8746     if (GRAY_SCALE_START < actualSize) {
8747         grayScaleStart = item->value[GRAY_SCALE_START].f32;
8748     }
8749     float grayScaleEnd = 0;
8750     if (GRAY_SCALE_END < actualSize) {
8751         grayScaleEnd = item->value[GRAY_SCALE_END].f32;
8752     }
8753     int32_t intArray[NUM_3];
8754     intArray[NUM_0] = blurStyle;
8755     intArray[NUM_1] = colorMode;
8756     intArray[NUM_2] = adaptiveColor;
8757     BlurOption blurOption = {{grayScaleStart, grayScaleEnd}};
8758 
8759     fullImpl->getNodeModifiers()->getCommonModifier()->setForegroundBlurStyle(
8760         node->uiNodeHandle, &intArray, scale, blurOption.grayscale.data(), blurOption.grayscale.size());
8761     return ERROR_CODE_NO_ERROR;
8762 }
8763 
ResetForegroundBlurStyle(ArkUI_NodeHandle node)8764 void ResetForegroundBlurStyle(ArkUI_NodeHandle node)
8765 {
8766     auto* fullImpl = GetFullImpl();
8767     fullImpl->getNodeModifiers()->getCommonModifier()->resetForegroundBlurStyle(node->uiNodeHandle);
8768 }
8769 
GetForegroundBlurStyle(ArkUI_NodeHandle node)8770 const ArkUI_AttributeItem* GetForegroundBlurStyle(ArkUI_NodeHandle node)
8771 {
8772     auto fullImpl = GetFullImpl();
8773     auto foregroundBlurStyle =
8774         fullImpl->getNodeModifiers()->getCommonModifier()->getForegroundBlurStyle(node->uiNodeHandle);
8775     g_numberValues[BLUR_STYLE_INDEX].i32 = UnConvertBlurStyle(foregroundBlurStyle.blurStyle);
8776     g_numberValues[COLOR_MODE_INDEX].i32 = foregroundBlurStyle.colorMode;
8777     g_numberValues[ADAPTIVE_COLOR_INDEX].i32 = foregroundBlurStyle.adaptiveColor;
8778     g_numberValues[SCALE_INDEX].f32 = foregroundBlurStyle.scale;
8779     g_numberValues[GRAY_SCALE_START].f32 = foregroundBlurStyle.grayScaleStart;
8780     g_numberValues[GRAY_SCALE_END].f32 = foregroundBlurStyle.grayScaleEnd;
8781     g_attributeItem.size = NUM_6;
8782     return &g_attributeItem;
8783 }
8784 
SetLayoutRect(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8785 int32_t SetLayoutRect(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8786 {
8787     auto* fullImpl = GetFullImpl();
8788     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
8789     if (actualSize < 0) {
8790         return ERROR_CODE_PARAM_INVALID;
8791     }
8792     if (item->value[2].i32 < 0) { // 2:index of width
8793         return ERROR_CODE_PARAM_INVALID;
8794     }
8795     if (item->value[3].i32 < 0) { // 3:index of height
8796         return ERROR_CODE_PARAM_INVALID;
8797     }
8798     ArkUI_Int32 intArray[NUM_4];
8799     intArray[0] = item->value[0].i32;
8800     intArray[1] = item->value[1].i32;
8801     intArray[2] = item->value[2].i32; // 2:index of width
8802     intArray[3] = item->value[3].i32; // 3:index of height
8803     fullImpl->getNodeModifiers()->getCommonModifier()->setLayoutRect(node->uiNodeHandle, &intArray);
8804     return ERROR_CODE_NO_ERROR;
8805 }
8806 
GetLayoutRect(ArkUI_NodeHandle node)8807 const ArkUI_AttributeItem* GetLayoutRect(ArkUI_NodeHandle node)
8808 {
8809     auto fullImpl = GetFullImpl();
8810     ArkUI_Int32 intArray[NUM_4];
8811     fullImpl->getNodeModifiers()->getCommonModifier()->getLayoutRect(node->uiNodeHandle, &intArray);
8812     g_numberValues[0].i32 = intArray[0];
8813     g_numberValues[1].i32 = intArray[1];
8814     g_numberValues[2].i32 = intArray[2]; // 2:index of width
8815     g_numberValues[3].i32 = intArray[3]; // 3:index of height
8816     g_attributeItem.size = NUM_4;
8817     return &g_attributeItem;
8818 }
8819 
ResetLayoutRect(ArkUI_NodeHandle node)8820 void ResetLayoutRect(ArkUI_NodeHandle node)
8821 {
8822     auto fullImpl = GetFullImpl();
8823     fullImpl->getNodeModifiers()->getCommonModifier()->resetLayoutRect(node->uiNodeHandle);
8824 }
8825 
SetFocusOnTouch(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8826 int32_t SetFocusOnTouch(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8827 {
8828     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
8829         return ERROR_CODE_PARAM_INVALID;
8830     }
8831     auto* fullImpl = GetFullImpl();
8832     fullImpl->getNodeModifiers()->getCommonModifier()->setFocusOnTouch(
8833         node->uiNodeHandle, item->value[NUM_0].i32);
8834     return ERROR_CODE_NO_ERROR;
8835 }
8836 
ResetFocusOnTouch(ArkUI_NodeHandle node)8837 void ResetFocusOnTouch(ArkUI_NodeHandle node)
8838 {
8839     auto* fullImpl = GetFullImpl();
8840     fullImpl->getNodeModifiers()->getCommonModifier()->resetFocusOnTouch(node->uiNodeHandle);
8841 }
8842 
GetFocusOnTouch(ArkUI_NodeHandle node)8843 const ArkUI_AttributeItem* GetFocusOnTouch(ArkUI_NodeHandle node)
8844 {
8845     auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getFocusOnTouch(node->uiNodeHandle);
8846     g_numberValues[0].i32 = resultValue;
8847     return &g_attributeItem;
8848 }
8849 
GetAccessibilityID(ArkUI_NodeHandle node)8850 const ArkUI_AttributeItem* GetAccessibilityID(ArkUI_NodeHandle node)
8851 {
8852     auto fullImpl = GetFullImpl();
8853     ArkUI_Int32 value = fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityID(node->uiNodeHandle);
8854     g_numberValues[0].i32 = value;
8855     g_attributeItem.size = NUM_1;
8856     return &g_attributeItem;
8857 }
8858 
SetAccessibilityState(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8859 int32_t SetAccessibilityState(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8860 {
8861     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
8862     ArkUI_AccessibilityState* statePtr = reinterpret_cast<ArkUI_AccessibilityState*>(item->object);
8863     CHECK_NULL_RETURN(statePtr, ERROR_CODE_PARAM_INVALID);
8864     if (statePtr->isDisabled.isSet && !InRegion(NUM_0, NUM_1, statePtr->isDisabled.value)) {
8865         return ERROR_CODE_PARAM_INVALID;
8866     }
8867     if (statePtr->isSelected.isSet && !InRegion(NUM_0, NUM_1, statePtr->isSelected.value)) {
8868         return ERROR_CODE_PARAM_INVALID;
8869     }
8870     if (statePtr->checkedType.isSet && !InRegion(NUM_0, NUM_1, statePtr->checkedType.value)) {
8871         return ERROR_CODE_PARAM_INVALID;
8872     }
8873     ArkUIAccessibilityState uiState;
8874     uiState.isDisabled = ArkUIOptionalInt { statePtr->isDisabled.isSet, statePtr->isDisabled.value };
8875     uiState.isSelected = ArkUIOptionalInt { statePtr->isSelected.isSet, statePtr->isSelected.value };
8876     uiState.checkedType = ArkUIOptionalInt { statePtr->checkedType.isSet, statePtr->checkedType.value };
8877     auto* fullImpl = GetFullImpl();
8878     fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityState(node->uiNodeHandle, uiState);
8879     return ERROR_CODE_NO_ERROR;
8880 }
8881 
GetAccessibilityState(ArkUI_NodeHandle node)8882 const ArkUI_AttributeItem* GetAccessibilityState(ArkUI_NodeHandle node)
8883 {
8884     static ArkUI_AccessibilityState state;
8885     ArkUIAccessibilityState uiState;
8886     auto* fullImpl = GetFullImpl();
8887     fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityState(node->uiNodeHandle, uiState);
8888     state.isDisabled = ArkUI_OptionalInt { uiState.isDisabled.isSet, uiState.isDisabled.value };
8889     state.isSelected = ArkUI_OptionalInt { uiState.isSelected.isSet, uiState.isSelected.value };
8890     state.checkedType = ArkUI_OptionalInt { uiState.checkedType.isSet, uiState.checkedType.value };
8891     g_attributeItem.object = &state;
8892     g_attributeItem.size = NUM_0;
8893     return &g_attributeItem;
8894 }
8895 
ResetAccessibilityState(ArkUI_NodeHandle node)8896 void ResetAccessibilityState(ArkUI_NodeHandle node)
8897 {
8898     auto fullImpl = GetFullImpl();
8899     fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityState(node->uiNodeHandle);
8900 }
8901 
SetAccessibilityValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8902 int32_t SetAccessibilityValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8903 {
8904     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
8905     ArkUI_AccessibilityValue* valuePtr = reinterpret_cast<ArkUI_AccessibilityValue*>(item->object);
8906     CHECK_NULL_RETURN(valuePtr, ERROR_CODE_PARAM_INVALID);
8907     if (valuePtr->current.isSet && ((!valuePtr->min.isSet) || (!valuePtr->max.isSet))) {
8908         return ERROR_CODE_PARAM_INVALID;
8909     }
8910     if (valuePtr->max.value < valuePtr->min.value) {
8911         return ERROR_CODE_PARAM_INVALID;
8912     }
8913     if ((valuePtr->current.value < valuePtr->min.value) || (valuePtr->current.value > valuePtr->max.value)) {
8914         return ERROR_CODE_PARAM_INVALID;
8915     }
8916     ArkUIAccessibilityValue uiValue;
8917     uiValue.min = ArkUIOptionalInt { valuePtr->min.isSet, valuePtr->min.value };
8918     uiValue.max = ArkUIOptionalInt { valuePtr->max.isSet, valuePtr->max.value };
8919     uiValue.current = ArkUIOptionalInt { valuePtr->current.isSet, valuePtr->current.value };
8920     uiValue.text = ArkUIOptionalCharPtr { valuePtr->text.isSet, valuePtr->text.value };
8921     auto* fullImpl = GetFullImpl();
8922     fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityValue(node->uiNodeHandle, uiValue);
8923     return ERROR_CODE_NO_ERROR;
8924 }
8925 
GetAccessibilityValue(ArkUI_NodeHandle node)8926 const ArkUI_AttributeItem* GetAccessibilityValue(ArkUI_NodeHandle node)
8927 {
8928     static ArkUI_AccessibilityValue value;
8929     ArkUIAccessibilityValue uiValue;
8930     auto* fullImpl = GetFullImpl();
8931     fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityValue(node->uiNodeHandle, uiValue);
8932     value.min = ArkUI_OptionalInt { uiValue.min.isSet, uiValue.min.value };
8933     value.max = ArkUI_OptionalInt { uiValue.max.isSet, uiValue.max.value };
8934     value.current = ArkUI_OptionalInt { uiValue.current.isSet, uiValue.current.value };
8935     value.text = ArkUI_OptionalCharPtr { uiValue.text.isSet, uiValue.text.value };
8936     g_attributeItem.object = &value;
8937     g_attributeItem.size = NUM_0;
8938     return &g_attributeItem;
8939 }
8940 
ResetAccessibilityValue(ArkUI_NodeHandle node)8941 void ResetAccessibilityValue(ArkUI_NodeHandle node)
8942 {
8943     auto fullImpl = GetFullImpl();
8944     fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityValue(node->uiNodeHandle);
8945 }
8946 
ResetAreaChangeRatio(ArkUI_NodeHandle node)8947 void ResetAreaChangeRatio(ArkUI_NodeHandle node)
8948 {
8949     if (node->areaChangeRadio) {
8950         delete[] node->areaChangeRadio->value;
8951         delete node->areaChangeRadio;
8952     }
8953     node->areaChangeRadio = nullptr;
8954 }
8955 
SetAreaChangeRatio(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8956 int32_t SetAreaChangeRatio(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8957 {
8958     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8959     if (actualSize < 0) {
8960         return ERROR_CODE_PARAM_INVALID;
8961     }
8962     ArkUI_Int32 radioLength = item->size;
8963     ArkUI_NumberValue* radioList = new ArkUI_NumberValue[radioLength];
8964     for (int i = 0; i < radioLength; ++i) {
8965         if (LessNotEqual(item->value[i].f32, 0.0f) || GreatNotEqual(item->value[i].f32, 1.0f)) {
8966             delete[] radioList;
8967             return ERROR_CODE_PARAM_INVALID;
8968         }
8969         radioList[i].f32 = item->value[i].f32;
8970     }
8971     if (node->areaChangeRadio) {
8972         ResetAreaChangeRatio(node);
8973     }
8974     node->areaChangeRadio = new ArkUI_AttributeItem { .value = radioList, .size = radioLength};
8975     return ERROR_CODE_NO_ERROR;
8976 }
8977 
GetAreaChangeRatio(ArkUI_NodeHandle node)8978 const ArkUI_AttributeItem* GetAreaChangeRatio(ArkUI_NodeHandle node)
8979 {
8980     return node->areaChangeRadio;
8981 }
8982 
CheckTransformCenter(const ArkUI_AttributeItem * item,int32_t size)8983 bool CheckTransformCenter(const ArkUI_AttributeItem* item, int32_t size)
8984 {
8985     CHECK_NULL_RETURN(item, false);
8986     if (CENTER_X_PERCENT_INDEX < size && (LessNotEqual(item->value[CENTER_X_PERCENT_INDEX].f32, 0.0f) ||
8987                                              GreatNotEqual(item->value[CENTER_X_PERCENT_INDEX].f32, 1.0f))) {
8988         return false;
8989     }
8990     if (CENTER_Y_PERCENT_INDEX < size && (LessNotEqual(item->value[CENTER_Y_PERCENT_INDEX].f32, 0.0f) ||
8991                                              GreatNotEqual(item->value[CENTER_Y_PERCENT_INDEX].f32, 1.0f))) {
8992         return false;
8993     }
8994     if (CENTER_Z_PERCENT_INDEX < size && (LessNotEqual(item->value[CENTER_Z_PERCENT_INDEX].f32, 0.0f) ||
8995                                              GreatNotEqual(item->value[CENTER_Z_PERCENT_INDEX].f32, 1.0f))) {
8996         return false;
8997     }
8998     return true;
8999 }
9000 
SetTransformCenter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9001 int32_t SetTransformCenter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9002 {
9003     auto* fullImpl = GetFullImpl();
9004     auto actualSize = CheckAttributeItemArray(item, 0);
9005     if (actualSize < 0) {
9006         return ERROR_CODE_PARAM_INVALID;
9007     }
9008     auto isTransformCenterValid = CheckTransformCenter(item, actualSize);
9009     if (!isTransformCenterValid) {
9010         return ERROR_CODE_PARAM_INVALID;
9011     }
9012     int32_t unit = GetDefaultUnit(node, UNIT_VP);
9013     CalcDimension centerX(HALF, DimensionUnit::PERCENT);
9014     if (CENTER_X_INDEX < actualSize) {
9015         centerX.SetValue(item->value[CENTER_X_INDEX].f32);
9016         centerX.SetUnit(static_cast<DimensionUnit>(unit));
9017     }
9018     CalcDimension centerY(HALF, DimensionUnit::PERCENT);
9019     if (CENTER_Y_INDEX < actualSize) {
9020         centerY.SetValue(item->value[CENTER_Y_INDEX].f32);
9021         centerY.SetUnit(static_cast<DimensionUnit>(unit));
9022     }
9023     CalcDimension centerZ(0, static_cast<DimensionUnit>(unit));
9024     if (CENTER_Z_INDEX < actualSize) {
9025         centerZ.SetValue(item->value[CENTER_Z_INDEX].f32);
9026     }
9027     if (CENTER_X_PERCENT_INDEX < actualSize) {
9028         centerX.SetValue(item->value[CENTER_X_PERCENT_INDEX].f32);
9029         centerX.SetUnit(DimensionUnit::PERCENT);
9030     }
9031     if (CENTER_Y_PERCENT_INDEX < actualSize) {
9032         centerY.SetValue(item->value[CENTER_Y_PERCENT_INDEX].f32);
9033         centerY.SetUnit(DimensionUnit::PERCENT);
9034     }
9035     if (CENTER_Z_PERCENT_INDEX < actualSize) {
9036         centerZ.SetValue(item->value[CENTER_Z_PERCENT_INDEX].f32);
9037         centerZ.SetUnit(DimensionUnit::PERCENT);
9038     }
9039     fullImpl->getNodeModifiers()->getCommonModifier()->setTransitionCenter(node->uiNodeHandle, centerX.Value(),
9040         static_cast<int32_t>(centerX.Unit()), centerY.Value(), static_cast<int32_t>(centerY.Unit()), centerZ.Value(),
9041         static_cast<int32_t>(centerZ.Unit()));
9042     return ERROR_CODE_NO_ERROR;
9043 }
9044 
SetOpacityTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9045 int32_t SetOpacityTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9046 {
9047     auto* fullImpl = GetFullImpl();
9048     auto actualSize = CheckAttributeItemArray(item, REQUIRED_THREE_PARAM);
9049     if (actualSize < 0) {
9050         return ERROR_CODE_PARAM_INVALID;
9051     }
9052     if (!CheckAnimation(item, actualSize, OPACITY_ANIMATION_BASE)) {
9053         return ERROR_CODE_PARAM_INVALID;
9054     }
9055     float opacity = DEFAULT_OPACITY;
9056     if (actualSize > 0) {
9057         opacity = item->value[0].f32;
9058     }
9059     ArkUIAnimationOptionType animationOption;
9060     ParseAnimation(item, actualSize, animationOption, OPACITY_ANIMATION_BASE);
9061     fullImpl->getNodeModifiers()->getCommonModifier()->setOpacityTransition(
9062         node->uiNodeHandle, opacity, &animationOption);
9063     return ERROR_CODE_NO_ERROR;
9064 }
9065 
SetRotateTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9066 int32_t SetRotateTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9067 {
9068     auto* fullImpl = GetFullImpl();
9069     auto actualSize = CheckAttributeItemArray(item, REQUIRED_SEVEN_PARAM);
9070     if (actualSize < 0) {
9071         return ERROR_CODE_PARAM_INVALID;
9072     }
9073     if (!CheckAnimation(item, actualSize, ROTATE_ANIMATION_BASE)) {
9074         return ERROR_CODE_PARAM_INVALID;
9075     }
9076     std::array<float, ARRAY_SIZE> rotateArray;
9077     for (int32_t i = 0; i < actualSize && i < static_cast<int32_t>(rotateArray.size()); i++) {
9078         rotateArray[i] = item->value[i].f32;
9079     }
9080     float angle = 0.0f;
9081     if (ROTATE_ANGLE_INDEX < actualSize) {
9082         angle = item->value[ROTATE_ANGLE_INDEX].f32;
9083     }
9084     float perspective = 0.0f;
9085     if (ROTATE_PERSPECTIVE_INDEX < actualSize) {
9086         perspective = item->value[ROTATE_PERSPECTIVE_INDEX].f32;
9087     }
9088     ArkUIAnimationOptionType animationOption;
9089     ParseAnimation(item, actualSize, animationOption, ROTATE_ANIMATION_BASE);
9090     fullImpl->getNodeModifiers()->getCommonModifier()->setRotateTransition(
9091         node->uiNodeHandle, &rotateArray[0], ARRAY_SIZE, perspective, angle, &animationOption);
9092     return ERROR_CODE_NO_ERROR;
9093 }
9094 
SetScaleTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9095 int32_t SetScaleTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9096 {
9097     auto* fullImpl = GetFullImpl();
9098     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FIVE_PARAM);
9099     if (actualSize < 0) {
9100         return ERROR_CODE_PARAM_INVALID;
9101     }
9102     if (!CheckAnimation(item, actualSize, SCALE_ANIMATION_BASE)) {
9103         return ERROR_CODE_PARAM_INVALID;
9104     }
9105     std::array<float, ARRAY_SIZE> scaleFloatArray;
9106     for (size_t i = 0; i < static_cast<uint32_t>(actualSize) && i < scaleFloatArray.size(); i++) {
9107         scaleFloatArray[i] = item->value[i].f32;
9108     }
9109     ArkUIAnimationOptionType animationOption;
9110     ParseAnimation(item, actualSize, animationOption, SCALE_ANIMATION_BASE);
9111     fullImpl->getNodeModifiers()->getCommonModifier()->setScaleTransition(
9112         node->uiNodeHandle, &scaleFloatArray[0], scaleFloatArray.size(), &animationOption);
9113     return ERROR_CODE_NO_ERROR;
9114 }
9115 
SetTranslateTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9116 int32_t SetTranslateTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9117 {
9118     auto* fullImpl = GetFullImpl();
9119     auto actualSize = CheckAttributeItemArray(item, REQUIRED_FIVE_PARAM);
9120     if (actualSize < 0) {
9121         return ERROR_CODE_PARAM_INVALID;
9122     }
9123     if (!CheckAnimation(item, actualSize, TRANSLATE_ANIMATION_BASE)) {
9124         return ERROR_CODE_PARAM_INVALID;
9125     }
9126     int32_t unit = GetDefaultUnit(node, UNIT_VP);
9127     CalcDimension xDimension(0, static_cast<DimensionUnit>(unit));
9128     if (X_INDEX < actualSize) {
9129         xDimension.SetValue(item->value[X_INDEX].f32);
9130     }
9131     CalcDimension yDimension(0, static_cast<DimensionUnit>(unit));
9132     if (Y_INDEX < actualSize) {
9133         yDimension.SetValue(item->value[Y_INDEX].f32);
9134     }
9135     CalcDimension zDimension(0, static_cast<DimensionUnit>(unit));
9136     if (Z_INDEX < actualSize) {
9137         zDimension.SetValue(item->value[Z_INDEX].f32);
9138     }
9139     ArkUIAnimationOptionType animationOption;
9140     ParseAnimation(item, actualSize, animationOption, TRANSLATE_ANIMATION_BASE);
9141     fullImpl->getNodeModifiers()->getCommonModifier()->setTranslateTransition(node->uiNodeHandle, xDimension.Value(),
9142         static_cast<int32_t>(xDimension.Unit()), yDimension.Value(), static_cast<int32_t>(yDimension.Unit()),
9143         zDimension.Value(), static_cast<int32_t>(zDimension.Unit()), &animationOption);
9144     return ERROR_CODE_NO_ERROR;
9145 }
9146 
SetMoveTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9147 int32_t SetMoveTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9148 {
9149     auto* fullImpl = GetFullImpl();
9150     auto actualSize = CheckAttributeItemArray(item, REQUIRED_THREE_PARAM);
9151     if (actualSize < 0) {
9152         return ERROR_CODE_PARAM_INVALID;
9153     }
9154     if (!CheckAnimation(item, actualSize, MOVE_ANIMATION_BASE)) {
9155         return ERROR_CODE_PARAM_INVALID;
9156     }
9157     int edgeType = ArkUI_TransitionEdge::ARKUI_TRANSITION_EDGE_START;
9158     if (!InRegion(NUM_0, NUM_3, item->value[NUM_0].i32)) {
9159         return ERROR_CODE_PARAM_INVALID;
9160     }
9161     edgeType = item->value[NUM_0].i32;
9162     ArkUIAnimationOptionType animationOption;
9163     ParseAnimation(item, actualSize, animationOption, MOVE_ANIMATION_BASE);
9164     fullImpl->getNodeModifiers()->getCommonModifier()->setMoveTransition(
9165         node->uiNodeHandle, edgeType, &animationOption);
9166     return ERROR_CODE_NO_ERROR;
9167 }
9168 
SetOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9169 int32_t SetOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9170 {
9171     auto* fullImpl = GetFullImpl();
9172     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
9173     if (actualSize < 0) {
9174         return ERROR_CODE_PARAM_INVALID;
9175     }
9176     int32_t unit = GetDefaultUnit(node, UNIT_VP);
9177     CalcDimension xDimension(0, static_cast<DimensionUnit>(unit));
9178     xDimension.SetValue(item->value[NUM_0].f32);
9179     CalcDimension yDimension(0, static_cast<DimensionUnit>(unit));
9180     yDimension.SetValue(item->value[NUM_1].f32);
9181     std::array<float, TWO> offsetValue = { xDimension.Value(), yDimension.Value() };
9182     std::array<int32_t, TWO> offsetUnit = { static_cast<int32_t>(xDimension.Unit()),
9183         static_cast<int32_t>(yDimension.Unit()) };
9184     fullImpl->getNodeModifiers()->getCommonModifier()->setOffset(node->uiNodeHandle, &offsetValue[0], &offsetUnit[0]);
9185     return ERROR_CODE_NO_ERROR;
9186 }
9187 
SetMarkAnchor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9188 int32_t SetMarkAnchor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9189 {
9190     auto* fullImpl = GetFullImpl();
9191     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
9192     if (actualSize < 0) {
9193         return ERROR_CODE_PARAM_INVALID;
9194     }
9195     int32_t unit = GetDefaultUnit(node, UNIT_VP);
9196     CalcDimension xDimension(0, static_cast<DimensionUnit>(unit));
9197     xDimension.SetValue(item->value[NUM_0].f32);
9198     CalcDimension yDimension(0, static_cast<DimensionUnit>(unit));
9199     yDimension.SetValue(item->value[NUM_1].f32);
9200     fullImpl->getNodeModifiers()->getCommonModifier()->setMarkAnchor(node->uiNodeHandle, xDimension.Value(),
9201        unit, yDimension.Value(), unit);
9202     return ERROR_CODE_NO_ERROR;
9203 }
9204 
SetAlignRules(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9205 int32_t SetAlignRules(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9206 {
9207     node->alignRuleOption = item->object;
9208 
9209     if (item->size < 0 || item->object == nullptr) {
9210         return ERROR_CODE_PARAM_INVALID;
9211     }
9212     auto* fullImpl = GetFullImpl();
9213     auto* option = reinterpret_cast<ArkUI_AlignmentRuleOption*>(item->object);
9214     char* anchors[NUM_6];
9215     ArkUI_Int32 aligns[NUM_6];
9216     if (option->left.hasValue) {
9217         // 0 -> left
9218         anchors[0] = const_cast<char*>(option->left.anchor.c_str());
9219         aligns[0] = option->left.align + NUM_1;
9220     }
9221     if (option->middle.hasValue) {
9222         // 1 -> middle
9223         anchors[1] = const_cast<char*>(option->middle.anchor.c_str());
9224         aligns[1] = option->middle.align + NUM_1;
9225     }
9226     if (option->right.hasValue) {
9227         // 2 -> right
9228         anchors[2] = const_cast<char*>(option->right.anchor.c_str());
9229         aligns[2] = option->right.align + NUM_1;
9230     }
9231     if (option->top.hasValue) {
9232         // 3 -> top
9233         anchors[3] = const_cast<char*>(option->top.anchor.c_str());
9234         aligns[3] = option->top.align + NUM_1;
9235     }
9236     if (option->center.hasValue) {
9237         // 4 -> center
9238         anchors[4] = const_cast<char*>(option->center.anchor.c_str());
9239         aligns[4] = option->center.align + NUM_1;
9240     }
9241     if (option->bottom.hasValue) {
9242         // 5 -> bottom
9243         anchors[5] = const_cast<char*>(option->bottom.anchor.c_str());
9244         aligns[5] = option->bottom.align + NUM_1;
9245     }
9246     fullImpl->getNodeModifiers()->getCommonModifier()->setAlignRules(node->uiNodeHandle, anchors, aligns, NUM_6);
9247     fullImpl->getNodeModifiers()->getCommonModifier()->setBias(
9248         node->uiNodeHandle, option->biasHorizontal, option->biasVertical);
9249     return ERROR_CODE_NO_ERROR;
9250 }
9251 
ResetAlignRules(ArkUI_NodeHandle node)9252 void ResetAlignRules(ArkUI_NodeHandle node)
9253 {
9254     auto* fullImpl = GetFullImpl();
9255     fullImpl->getNodeModifiers()->getCommonModifier()->resetAlignRules(node->uiNodeHandle);
9256     node->alignRuleOption = nullptr;
9257 }
9258 
SetTextContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9259 int32_t SetTextContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9260 {
9261     auto* fullImpl = GetFullImpl();
9262     if (!CheckAttributeString(item)) {
9263         return ERROR_CODE_PARAM_INVALID;
9264     }
9265     fullImpl->getNodeModifiers()->getTextModifier()->setContent(node->uiNodeHandle, item->string);
9266     return ERROR_CODE_NO_ERROR;
9267 }
9268 
SetLineHeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9269 int32_t SetLineHeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9270 {
9271     auto* fullImpl = GetFullImpl();
9272     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9273     if (actualSize < 0) {
9274         return ERROR_CODE_PARAM_INVALID;
9275     }
9276     int32_t unit = GetDefaultUnit(node, UNIT_FP);
9277     switch (node->type) {
9278         case ARKUI_NODE_TEXT:
9279             fullImpl->getNodeModifiers()->getTextModifier()->setTextLineHeight(
9280                 node->uiNodeHandle, item->value[0].f32, unit);
9281             break;
9282         case ARKUI_NODE_SPAN:
9283             fullImpl->getNodeModifiers()->getSpanModifier()->setSpanLineHeight(
9284                 node->uiNodeHandle, item->value[0].f32, unit);
9285             break;
9286         case ARKUI_NODE_TEXT_INPUT:
9287             fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputLineHeight(
9288                 node->uiNodeHandle, item->value[0].f32, unit);
9289             break;
9290         case ARKUI_NODE_TEXT_AREA:
9291             fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaLineHeight(
9292                 node->uiNodeHandle, item->value[0].f32, unit);
9293             break;
9294         default:
9295             break;
9296     }
9297     return ERROR_CODE_NO_ERROR;
9298 }
9299 
SetDecoration(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9300 int32_t SetDecoration(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9301 {
9302     auto* fullImpl = GetFullImpl();
9303     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9304     if (actualSize < 0) {
9305         return ERROR_CODE_PARAM_INVALID;
9306     }
9307     if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH)) {
9308         return ERROR_CODE_PARAM_INVALID;
9309     }
9310     if (DECORATION_STYLE_INDEX < actualSize && (item->value[DECORATION_STYLE_INDEX].i32 < 0 ||
9311         item->value[DECORATION_STYLE_INDEX].i32 > static_cast<int32_t>(ARKUI_TEXT_DECORATION_STYLE_WAVY))) {
9312         return ERROR_CODE_PARAM_INVALID;
9313     }
9314     int32_t decoration = item->value[0].i32;
9315     auto decorationColor = Color::BLACK.GetValue();
9316     if (DECORATION_COLOR_INDEX < actualSize) {
9317         decorationColor = item->value[DECORATION_COLOR_INDEX].u32;
9318     }
9319     int32_t decorationStyle = 0;
9320     if (DECORATION_STYLE_INDEX < actualSize) {
9321         decorationStyle = item->value[DECORATION_STYLE_INDEX].i32;
9322     }
9323     switch (node->type) {
9324         case ARKUI_NODE_SPAN:
9325             fullImpl->getNodeModifiers()->getSpanModifier()->setSpanDecoration(
9326                 node->uiNodeHandle, decoration, decorationColor, decorationStyle);
9327             break;
9328         case ARKUI_NODE_TEXT:
9329             fullImpl->getNodeModifiers()->getTextModifier()->setTextDecoration(
9330                 node->uiNodeHandle, decoration, decorationColor, decorationStyle);
9331             break;
9332         default:
9333             break;
9334     }
9335     return ERROR_CODE_NO_ERROR;
9336 }
9337 
SetTextCase(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9338 int32_t SetTextCase(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9339 {
9340     auto* fullImpl = GetFullImpl();
9341     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9342     if (actualSize < 0) {
9343         return ERROR_CODE_PARAM_INVALID;
9344     }
9345     if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_TEXT_CASE_UPPER)) {
9346         return ERROR_CODE_PARAM_INVALID;
9347     }
9348     switch (node->type) {
9349         case ARKUI_NODE_SPAN:
9350             fullImpl->getNodeModifiers()->getSpanModifier()->setSpanTextCase(node->uiNodeHandle, item->value[0].i32);
9351             break;
9352         case ARKUI_NODE_TEXT:
9353             fullImpl->getNodeModifiers()->getTextModifier()->setTextCase(node->uiNodeHandle, item->value[0].i32);
9354             break;
9355         default:
9356             break;
9357     }
9358     return ERROR_CODE_NO_ERROR;
9359 }
9360 
SetLetterSpacing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9361 int32_t SetLetterSpacing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9362 {
9363     auto* fullImpl = GetFullImpl();
9364     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9365     if (actualSize < 0) {
9366         return ERROR_CODE_PARAM_INVALID;
9367     }
9368     ArkUIStringAndFloat letterSpacingValue = { item->value[0].f32, nullptr };
9369     switch (node->type) {
9370         case ARKUI_NODE_SPAN:
9371             fullImpl->getNodeModifiers()->getSpanModifier()->setSpanLetterSpacing(
9372                 node->uiNodeHandle, &letterSpacingValue);
9373             break;
9374         case ARKUI_NODE_TEXT:
9375             fullImpl->getNodeModifiers()->getTextModifier()->setTextLetterSpacing(
9376                 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
9377             break;
9378         default:
9379             break;
9380     }
9381     return ERROR_CODE_NO_ERROR;
9382 }
9383 
SetMaxLines(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9384 int32_t SetMaxLines(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9385 {
9386     auto* fullImpl = GetFullImpl();
9387     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9388     if (actualSize < 0) {
9389         return ERROR_CODE_PARAM_INVALID;
9390     }
9391     switch (node->type) {
9392         case ARKUI_NODE_TEXT:
9393             fullImpl->getNodeModifiers()->getTextModifier()->setTextMaxLines(node->uiNodeHandle, item->value[0].i32);
9394             break;
9395         case ARKUI_NODE_TEXT_INPUT:
9396             fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputMaxLines(
9397                 node->uiNodeHandle, item->value[0].i32);
9398             break;
9399         case ARKUI_NODE_TEXT_AREA:
9400             fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaMaxLines(
9401                 node->uiNodeHandle, item->value[0].i32);
9402             break;
9403         default:
9404             break;
9405     }
9406     return ERROR_CODE_NO_ERROR;
9407 }
9408 
SetTextAlign(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9409 int32_t SetTextAlign(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9410 {
9411     auto* fullImpl = GetFullImpl();
9412     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9413     if (actualSize < 0) {
9414         return ERROR_CODE_PARAM_INVALID;
9415     }
9416     if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_TEXT_ALIGNMENT_JUSTIFY)) {
9417         return ERROR_CODE_PARAM_INVALID;
9418     }
9419     switch (node->type) {
9420         case ARKUI_NODE_TEXT_INPUT:
9421             fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextAlign(
9422                 node->uiNodeHandle, item->value[0].i32);
9423             break;
9424         case ARKUI_NODE_TEXT:
9425             fullImpl->getNodeModifiers()->getTextModifier()->setTextAlign(node->uiNodeHandle, item->value[0].i32);
9426             break;
9427         case ARKUI_NODE_TEXT_AREA:
9428             fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaTextAlign(
9429                 node->uiNodeHandle, item->value[0].i32);
9430             break;
9431         default:
9432             break;
9433     }
9434     return ERROR_CODE_NO_ERROR;
9435 }
9436 
SetTextOverflow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9437 int32_t SetTextOverflow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9438 {
9439     auto* fullImpl = GetFullImpl();
9440     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9441     if (actualSize < 0) {
9442         return ERROR_CODE_PARAM_INVALID;
9443     }
9444     if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_TEXT_OVERFLOW_MARQUEE)) {
9445         return ERROR_CODE_PARAM_INVALID;
9446     }
9447     fullImpl->getNodeModifiers()->getTextModifier()->setTextOverflow(node->uiNodeHandle, item->value[0].i32);
9448     return ERROR_CODE_NO_ERROR;
9449 }
9450 
SetTextIndent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9451 int32_t SetTextIndent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9452 {
9453     auto* fullImpl = GetFullImpl();
9454     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9455     if (actualSize < 0) {
9456         return ERROR_CODE_PARAM_INVALID;
9457     }
9458     fullImpl->getNodeModifiers()->getTextModifier()->setTextIndent(node->uiNodeHandle,
9459         item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
9460     return ERROR_CODE_NO_ERROR;
9461 }
9462 
ResetTextIndent(ArkUI_NodeHandle node)9463 void ResetTextIndent(ArkUI_NodeHandle node)
9464 {
9465     auto* fullImpl = GetFullImpl();
9466     fullImpl->getNodeModifiers()->getTextModifier()->setTextIndent(node->uiNodeHandle,
9467         0.0f, UNIT_FP);
9468 }
9469 
SetTextWordBreak(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9470 int32_t SetTextWordBreak(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9471 {
9472     auto* fullImpl = GetFullImpl();
9473     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9474     if (actualSize < 0) {
9475         return ERROR_CODE_PARAM_INVALID;
9476     }
9477     fullImpl->getNodeModifiers()->getTextModifier()->setWordBreak(
9478         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
9479     return ERROR_CODE_NO_ERROR;
9480 }
9481 
GetTextWordBreak(ArkUI_NodeHandle node)9482 const ArkUI_AttributeItem* GetTextWordBreak(ArkUI_NodeHandle node)
9483 {
9484     auto fullImpl = GetFullImpl();
9485     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextWordBreak(node->uiNodeHandle);
9486     g_attributeItem.size = REQUIRED_ONE_PARAM;
9487     return &g_attributeItem;
9488 }
9489 
ResetTextWordBreak(ArkUI_NodeHandle node)9490 void ResetTextWordBreak(ArkUI_NodeHandle node)
9491 {
9492     auto* fullImpl = GetFullImpl();
9493     fullImpl->getNodeModifiers()->getTextModifier()->resetWordBreak(node->uiNodeHandle);
9494 }
9495 
SetTextSelectedBackgroundColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9496 int32_t SetTextSelectedBackgroundColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9497 {
9498     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9499     if (actualSize < 0) {
9500         return ERROR_CODE_PARAM_INVALID;
9501     }
9502     auto* fullImpl = GetFullImpl();
9503     fullImpl->getNodeModifiers()->getTextModifier()->setTextSelectedBackgroundColor(
9504         node->uiNodeHandle, item->value[0].u32);
9505     return ERROR_CODE_NO_ERROR;
9506 }
9507 
GetTextSelectedBackgroundColor(ArkUI_NodeHandle node)9508 const ArkUI_AttributeItem* GetTextSelectedBackgroundColor(ArkUI_NodeHandle node)
9509 {
9510     g_numberValues[0].u32 = GetFullImpl()->getNodeModifiers()->getTextModifier()->getTextSelectedBackgroundColor(
9511         node->uiNodeHandle);
9512     return &g_attributeItem;
9513 }
9514 
ResetTextSelectedBackgroundColor(ArkUI_NodeHandle node)9515 void ResetTextSelectedBackgroundColor(ArkUI_NodeHandle node)
9516 {
9517     auto* fullImpl = GetFullImpl();
9518     fullImpl->getNodeModifiers()->getTextModifier()->resetTextSelectedBackgroundColor(node->uiNodeHandle);
9519 }
9520 
SetTextEllipsisMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9521 int32_t SetTextEllipsisMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9522 {
9523     auto* fullImpl = GetFullImpl();
9524     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9525     if (actualSize < 0) {
9526         return ERROR_CODE_PARAM_INVALID;
9527     }
9528     fullImpl->getNodeModifiers()->getTextModifier()->setEllipsisMode(
9529         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
9530     return ERROR_CODE_NO_ERROR;
9531 }
9532 
SetLineSpacing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9533 int32_t SetLineSpacing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9534 {
9535     auto* fullImpl = GetFullImpl();
9536     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9537     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
9538         return ERROR_CODE_PARAM_INVALID;
9539     }
9540     if (node->type == ARKUI_NODE_TEXT) {
9541         fullImpl->getNodeModifiers()->getTextModifier()->setTextLineSpacing(
9542             node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
9543     }
9544     return ERROR_CODE_NO_ERROR;
9545 }
9546 
SetTextContentWithStyledString(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9547 int32_t SetTextContentWithStyledString(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9548 {
9549     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
9550     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
9551     auto* fullImpl = GetFullImpl();
9552     auto* styledString = reinterpret_cast<ArkUI_StyledString*>(item->object);
9553     fullImpl->getNodeModifiers()->getTextModifier()->setTextContentWithStyledString(node->uiNodeHandle, styledString);
9554     return ERROR_CODE_NO_ERROR;
9555 }
9556 
ResetTextContentWithStyledString(ArkUI_NodeHandle node)9557 void ResetTextContentWithStyledString(ArkUI_NodeHandle node)
9558 {
9559     auto* fullImpl = GetFullImpl();
9560     fullImpl->getNodeModifiers()->getTextModifier()->resetTextContentWithStyledString(node->uiNodeHandle);
9561 }
9562 
SetHalfLeading(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9563 int32_t SetHalfLeading(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9564 {
9565     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9566     if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
9567         return ERROR_CODE_PARAM_INVALID;
9568     }
9569     // already check in entry point.
9570     auto* fullImpl = GetFullImpl();
9571     fullImpl->getNodeModifiers()->getTextModifier()->setTextHalfLeading(
9572         node->uiNodeHandle, item->value[NUM_0].i32);
9573     return ERROR_CODE_NO_ERROR;
9574 }
9575 
GetHalfLeading(ArkUI_NodeHandle node)9576 const ArkUI_AttributeItem* GetHalfLeading(ArkUI_NodeHandle node)
9577 {
9578     auto fullImpl = GetFullImpl();
9579     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextHalfLeading(node->uiNodeHandle);
9580     g_attributeItem.size = REQUIRED_ONE_PARAM;
9581     return &g_attributeItem;
9582 }
9583 
ResetHalfLeading(ArkUI_NodeHandle node)9584 void ResetHalfLeading(ArkUI_NodeHandle node)
9585 {
9586     auto* fullImpl = GetFullImpl();
9587     fullImpl->getNodeModifiers()->getTextModifier()->resetTextHalfLeading(node->uiNodeHandle);
9588 }
9589 
GetTextEllipsisMode(ArkUI_NodeHandle node)9590 const ArkUI_AttributeItem* GetTextEllipsisMode(ArkUI_NodeHandle node)
9591 {
9592     auto fullImpl = GetFullImpl();
9593     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextEllipsisMode(node->uiNodeHandle);
9594     g_attributeItem.size = REQUIRED_ONE_PARAM;
9595     return &g_attributeItem;
9596 }
9597 
GetLineSpacing(ArkUI_NodeHandle node)9598 const ArkUI_AttributeItem* GetLineSpacing(ArkUI_NodeHandle node)
9599 {
9600     auto fullImpl = GetFullImpl();
9601     if (node->type == ARKUI_NODE_TEXT) {
9602         g_numberValues[NUM_0].f32 =
9603             fullImpl->getNodeModifiers()->getTextModifier()->getTextLineSpacing(node->uiNodeHandle);
9604         g_numberValues[NUM_0].i32 = static_cast<int32_t>(node->lengthMetricUnit);
9605         g_attributeItem.size = REQUIRED_ONE_PARAM;
9606     }
9607     return &g_attributeItem;
9608 }
9609 
ResetTextEllipsisMode(ArkUI_NodeHandle node)9610 void ResetTextEllipsisMode(ArkUI_NodeHandle node)
9611 {
9612     auto* fullImpl = GetFullImpl();
9613     fullImpl->getNodeModifiers()->getTextModifier()->resetEllipsisMode(node->uiNodeHandle);
9614 }
9615 
SetTextEnableDateDetector(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9616 int32_t SetTextEnableDateDetector(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9617 {
9618     auto* fullImpl = GetFullImpl();
9619     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9620     if (actualSize < 0) {
9621         return ERROR_CODE_PARAM_INVALID;
9622     }
9623     fullImpl->getNodeModifiers()->getTextModifier()->setEnableDataDetector(
9624         node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
9625     return ERROR_CODE_NO_ERROR;
9626 }
9627 
GetTextEnableDateDetector(ArkUI_NodeHandle node)9628 const ArkUI_AttributeItem* GetTextEnableDateDetector(ArkUI_NodeHandle node)
9629 {
9630     auto fullImpl = GetFullImpl();
9631     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getEnableDataDetector(node->uiNodeHandle);
9632     g_attributeItem.size = REQUIRED_ONE_PARAM;
9633     return &g_attributeItem;
9634 }
9635 
ResetTextEnableDateDetector(ArkUI_NodeHandle node)9636 void ResetTextEnableDateDetector(ArkUI_NodeHandle node)
9637 {
9638     auto* fullImpl = GetFullImpl();
9639     fullImpl->getNodeModifiers()->getTextModifier()->resetEnableDataDetector(node->uiNodeHandle);
9640 }
9641 
SetTextDataDetectorConfig(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9642 int32_t SetTextDataDetectorConfig(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9643 {
9644     auto* fullImpl = GetFullImpl();
9645     ArkUI_Uint32 values[item->size];
9646     for (int i = 0; i < item->size; i++) {
9647         values[i] = item->value[i].i32;
9648     }
9649     fullImpl->getNodeModifiers()->getTextModifier()->setTextDataDetectorConfig(
9650         node->uiNodeHandle, values, item->size);
9651     return ERROR_CODE_NO_ERROR;
9652 }
9653 
GetTextDataDetectorConfig(ArkUI_NodeHandle node)9654 const ArkUI_AttributeItem* GetTextDataDetectorConfig(ArkUI_NodeHandle node)
9655 {
9656     ArkUI_Int32 values[32];
9657     auto* fullImpl = GetFullImpl();
9658     auto size = fullImpl->getNodeModifiers()->getTextModifier()->getTextDataDetectorConfig(
9659         node->uiNodeHandle, &values);
9660     for (auto i = 0; i < size; i++) {
9661         g_numberValues[i].i32 = values[i];
9662     }
9663     g_attributeItem.size = size;
9664     return &g_attributeItem;
9665 }
9666 
ResetTextDataDetectorConfig(ArkUI_NodeHandle node)9667 void ResetTextDataDetectorConfig(ArkUI_NodeHandle node)
9668 {
9669     auto* fullImpl = GetFullImpl();
9670     fullImpl->getNodeModifiers()->getTextModifier()->resetTextDataDetectorConfig(node->uiNodeHandle);
9671 }
9672 
SetFontFeature(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9673 int32_t SetFontFeature(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9674 {
9675     if (item->string == nullptr) {
9676         return ERROR_CODE_PARAM_INVALID;
9677     }
9678     auto* fullImpl = GetFullImpl();
9679     switch (node->type) {
9680         case ARKUI_NODE_TEXT_INPUT:
9681             fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontFeature(
9682                 node->uiNodeHandle, item->string);
9683             break;
9684         case ARKUI_NODE_TEXT:
9685             fullImpl->getNodeModifiers()->getTextModifier()->setTextFontFeature(node->uiNodeHandle, item->string);
9686             break;
9687         case ARKUI_NODE_TEXT_AREA:
9688             fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontFeature(
9689                 node->uiNodeHandle, item->string);
9690             break;
9691         default:
9692             break;
9693     }
9694     return ERROR_CODE_NO_ERROR;
9695 }
9696 
GetFontFeature(ArkUI_NodeHandle node)9697 const ArkUI_AttributeItem* GetFontFeature(ArkUI_NodeHandle node)
9698 {
9699     auto fullImpl = GetFullImpl();
9700     ArkUI_CharPtr feature = nullptr;
9701     switch (node->type) {
9702         case ARKUI_NODE_TEXT_INPUT:
9703             feature = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputFontFeature(node->uiNodeHandle);
9704             g_attributeItem.string = (feature != nullptr ? feature : EMPTY_STR.c_str());
9705             break;
9706         case ARKUI_NODE_TEXT:
9707             feature = fullImpl->getNodeModifiers()->getTextModifier()->getTextFontFeature(node->uiNodeHandle);
9708             g_attributeItem.string = (feature != nullptr ? feature : EMPTY_STR.c_str());
9709             break;
9710         case ARKUI_NODE_TEXT_AREA:
9711             feature = fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaFontFeature(node->uiNodeHandle);
9712             g_attributeItem.string = (feature != nullptr ? feature : EMPTY_STR.c_str());
9713             break;
9714         default:
9715             break;
9716     }
9717     return &g_attributeItem;
9718 }
9719 
ResetFontFeature(ArkUI_NodeHandle node)9720 void ResetFontFeature(ArkUI_NodeHandle node)
9721 {
9722     auto* fullImpl = GetFullImpl();
9723     switch (node->type) {
9724         case ARKUI_NODE_TEXT_INPUT:
9725             fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontFeature(node->uiNodeHandle);
9726             break;
9727         case ARKUI_NODE_TEXT:
9728             fullImpl->getNodeModifiers()->getTextModifier()->resetTextFontFeature(node->uiNodeHandle);
9729             break;
9730         case ARKUI_NODE_TEXT_AREA:
9731             fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontFeature(node->uiNodeHandle);
9732             break;
9733         default:
9734             break;
9735     }
9736 }
ResetLineSpacing(ArkUI_NodeHandle node)9737 void ResetLineSpacing(ArkUI_NodeHandle node)
9738 {
9739     auto fullImpl = GetFullImpl();
9740     switch (node->type) {
9741         case ARKUI_NODE_TEXT:
9742             fullImpl->getNodeModifiers()->getTextModifier()->resetTextLineSpacing(node->uiNodeHandle);
9743             break;
9744         default:
9745             break;
9746     }
9747 }
9748 
SetSpanContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9749 int32_t SetSpanContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9750 {
9751     auto* fullImpl = GetFullImpl();
9752     if (!CheckAttributeString(item)) {
9753         return ERROR_CODE_PARAM_INVALID;
9754     }
9755     fullImpl->getNodeModifiers()->getSpanModifier()->setContent(node->uiNodeHandle, item->string);
9756     return ERROR_CODE_NO_ERROR;
9757 }
9758 
SetSpanTextBackgroundStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9759 int32_t SetSpanTextBackgroundStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9760 {
9761     auto* fullImpl = GetFullImpl();
9762     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9763     if (actualSize < 0) {
9764         return ERROR_CODE_PARAM_INVALID;
9765     }
9766     float radiusVals[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
9767     int32_t unit = GetDefaultUnit(node, UNIT_VP);
9768     int radiusUnits[ALLOW_SIZE_4] = { unit, unit, unit, unit };
9769 
9770     if (item->size == ALLOW_SIZE_2) {
9771         if (LessNotEqual(item->value[NUM_1].f32, 0.0f)) {
9772             return ERROR_CODE_PARAM_INVALID;
9773         }
9774         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
9775             radiusVals[i] = item->value[1].f32;
9776         }
9777     } else if (item->size == ALLOW_SIZE_5) {
9778         for (int i = 0; i < ALLOW_SIZE_4; ++i) {
9779             if (LessNotEqual(item->value[i + NUM_1].f32, 0.0f)) {
9780                 return ERROR_CODE_PARAM_INVALID;
9781             } else {
9782                 radiusVals[i] = item->value[i + NUM_1].f32;
9783             }
9784         }
9785     } else {
9786         return ERROR_CODE_PARAM_INVALID;
9787     }
9788 
9789     fullImpl->getNodeModifiers()->getSpanModifier()->setSpanTextBackgroundStyle(
9790         node->uiNodeHandle, item->value[NUM_0].u32, radiusVals, radiusUnits, NUM_4);
9791     return ERROR_CODE_NO_ERROR;
9792 }
9793 
SetVerticalAlign(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9794 int32_t SetVerticalAlign(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9795 {
9796     auto* fullImpl = GetFullImpl();
9797     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9798     if (actualSize < 0) {
9799         return ERROR_CODE_PARAM_INVALID;
9800     }
9801     if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_SPAN_ALIGNMENT_TOP)) {
9802         return ERROR_CODE_PARAM_INVALID;
9803     }
9804     fullImpl->getNodeModifiers()->getImageSpanModifier()->setImageSpanVerticalAlign(
9805         node->uiNodeHandle, IMAGE_SPAN_ALIGNMENT_ARRAY[item->value[0].i32]);
9806     return ERROR_CODE_NO_ERROR;
9807 }
9808 
SetPixelMapSrc(ArkUI_NodeHandle node,const std::shared_ptr<Napi::DrawableDescriptor> & descriptor)9809 int32_t SetPixelMapSrc(ArkUI_NodeHandle node, const std::shared_ptr<Napi::DrawableDescriptor>& descriptor)
9810 {
9811     auto* fullImpl = GetFullImpl();
9812     fullImpl->getNodeModifiers()->getImageModifier()->setPixelMap(node->uiNodeHandle, descriptor.get());
9813     return ERROR_CODE_NO_ERROR;
9814 }
9815 
SetPixelMapArraySrc(ArkUI_NodeHandle node,const std::shared_ptr<Napi::AnimatedDrawableDescriptor> & descriptor)9816 int32_t SetPixelMapArraySrc(ArkUI_NodeHandle node, const std::shared_ptr<Napi::AnimatedDrawableDescriptor>& descriptor)
9817 {
9818     auto* fullImpl = GetFullImpl();
9819     fullImpl->getNodeModifiers()->getImageModifier()->setPixelMapArray(node->uiNodeHandle, descriptor.get());
9820     return ERROR_CODE_NO_ERROR;
9821 }
9822 
SetResourceSrc(ArkUI_NodeHandle node,const std::shared_ptr<ArkUI_Resource> & resource)9823 int32_t SetResourceSrc(ArkUI_NodeHandle node, const std::shared_ptr<ArkUI_Resource>& resource)
9824 {
9825     auto* fullImpl = GetFullImpl();
9826     fullImpl->getNodeModifiers()->getImageModifier()->setResourceSrc(node->uiNodeHandle, resource.get());
9827     return ERROR_CODE_NO_ERROR;
9828 }
9829 
SetImageSrc(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9830 int32_t SetImageSrc(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9831 {
9832     bool isString = CheckAttributeString(item);
9833     bool isObject = CheckAttributeObject(item);
9834     if ((isString && isObject) || (!isString && !isObject)) {
9835         return ERROR_CODE_PARAM_INVALID;
9836     }
9837     if (isString) {
9838         auto* fullImpl = GetFullImpl();
9839         fullImpl->getNodeModifiers()->getImageModifier()->setSrc(node->uiNodeHandle, item->string);
9840         return ERROR_CODE_NO_ERROR;
9841     }
9842 
9843     auto drawableDescriptor = reinterpret_cast<ArkUI_DrawableDescriptor*>(item->object);
9844     if (!drawableDescriptor) {
9845         return ERROR_CODE_PARAM_INVALID;
9846     }
9847     node->drawableDescriptor = drawableDescriptor;
9848     if (!drawableDescriptor->drawableDescriptor && !drawableDescriptor->resource &&
9849         !drawableDescriptor->animatedDrawableDescriptor) {
9850         return ERROR_CODE_PARAM_INVALID;
9851     }
9852     if (drawableDescriptor->drawableDescriptor) {
9853         return SetPixelMapSrc(node, drawableDescriptor->drawableDescriptor);
9854     } else if (drawableDescriptor->animatedDrawableDescriptor) {
9855         return SetPixelMapArraySrc(node, drawableDescriptor->animatedDrawableDescriptor);
9856     } else {
9857         return SetResourceSrc(node, drawableDescriptor->resource);
9858     }
9859 }
9860 
SetImageSpanSrc(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9861 int32_t SetImageSpanSrc(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9862 {
9863     auto* fullImpl = GetFullImpl();
9864     if (CheckAttributeString(item)) {
9865         fullImpl->getNodeModifiers()->getImageModifier()->setSrc(node->uiNodeHandle, item->string);
9866         return ERROR_CODE_NO_ERROR;
9867     } else {
9868         return SetImageSrc(node, item);
9869     }
9870 }
9871 
SetImageSpanBaselineOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9872 int32_t SetImageSpanBaselineOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9873 {
9874     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9875     if (actualSize < 0) {
9876         return ERROR_CODE_PARAM_INVALID;
9877     }
9878     // already check in entry point.
9879     auto* fullImpl = GetFullImpl();
9880     fullImpl->getNodeModifiers()->getImageSpanModifier()->setImageSpanBaselineOffset(
9881         node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
9882     return ERROR_CODE_NO_ERROR;
9883 }
9884 
ResetImageSpanBaselineOffset(ArkUI_NodeHandle node)9885 void ResetImageSpanBaselineOffset(ArkUI_NodeHandle node)
9886 {
9887     // already check in entry point.
9888     auto* fullImpl = GetFullImpl();
9889     fullImpl->getNodeModifiers()->getImageSpanModifier()->
9890         resetImageSpanBaselineOffset(node->uiNodeHandle);
9891 }
9892 
GetImageSpanBaselineOffset(ArkUI_NodeHandle node)9893 const ArkUI_AttributeItem* GetImageSpanBaselineOffset(ArkUI_NodeHandle node)
9894 {
9895     // already check in entry point.
9896     auto* fullImpl = GetFullImpl();
9897     int32_t unit = GetDefaultUnit(node, UNIT_FP);
9898     g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getImageSpanModifier()->
9899         getImageSpanBaselineOffset(node->uiNodeHandle, unit);
9900     g_attributeItem.size = REQUIRED_ONE_PARAM;
9901     return &g_attributeItem;
9902 }
9903 
SetObjectFit(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9904 int32_t SetObjectFit(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9905 {
9906     auto* fullImpl = GetFullImpl();
9907     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9908     if (actualSize < 0) {
9909         return ERROR_CODE_PARAM_INVALID;
9910     }
9911     if (item->value[0].i32 < 0 || item->value[0].i32 >
9912         static_cast<int32_t>(ARKUI_OBJECT_FIT_NONE_AND_ALIGN_BOTTOM_END)) {
9913         return ERROR_CODE_PARAM_INVALID;
9914     }
9915     fullImpl->getNodeModifiers()->getImageModifier()->setObjectFit(
9916         node->uiNodeHandle, OBJECT_FIT_ARRAY[item->value[0].i32]);
9917     return ERROR_CODE_NO_ERROR;
9918 }
9919 
SetInterpolation(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9920 int32_t SetInterpolation(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9921 {
9922     auto* fullImpl = GetFullImpl();
9923     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9924     if (actualSize < 0) {
9925         return ERROR_CODE_PARAM_INVALID;
9926     }
9927     if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_INTERPOLATION_HIGH)) {
9928         return ERROR_CODE_PARAM_INVALID;
9929     }
9930     fullImpl->getNodeModifiers()->getImageModifier()->setImageInterpolation(node->uiNodeHandle, item->value[0].i32);
9931     return ERROR_CODE_NO_ERROR;
9932 }
9933 
SetObjectRepeat(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9934 int32_t SetObjectRepeat(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9935 {
9936     auto* fullImpl = GetFullImpl();
9937     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9938     if (actualSize < 0) {
9939         return ERROR_CODE_PARAM_INVALID;
9940     }
9941     if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_REPEAT_XY)) {
9942         return ERROR_CODE_PARAM_INVALID;
9943     }
9944     fullImpl->getNodeModifiers()->getImageModifier()->setObjectRepeat(node->uiNodeHandle, item->value[0].i32);
9945     return ERROR_CODE_NO_ERROR;
9946 }
9947 
SetColorFilter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9948 int32_t SetColorFilter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9949 {
9950     auto* fullImpl = GetFullImpl();
9951     auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWENTY_PARAM);
9952     bool isObject = CheckAttributeObject(item);
9953     if ((actualSize < 0 && !isObject) || (actualSize > 0 && isObject)) {
9954         return ERROR_CODE_PARAM_INVALID;
9955     }
9956     if (isObject) {
9957         fullImpl->getNodeModifiers()->getImageModifier()->setDrawingColorFilter(node->uiNodeHandle, item->object);
9958         return ERROR_CODE_NO_ERROR;
9959     }
9960     std::vector<float> colorFloatArray;
9961     for (size_t i = 0; i < static_cast<uint32_t>(actualSize) && i < REQUIRED_TWENTY_PARAM; i++) {
9962         colorFloatArray.emplace_back(item->value[i].f32);
9963     }
9964     fullImpl->getNodeModifiers()->getImageModifier()->setColorFilter(
9965         node->uiNodeHandle, &colorFloatArray[0], colorFloatArray.size());
9966     return ERROR_CODE_NO_ERROR;
9967 }
9968 
SetAutoResize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9969 int32_t SetAutoResize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9970 {
9971     auto* fullImpl = GetFullImpl();
9972     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9973     if (actualSize < 0) {
9974         return ERROR_CODE_PARAM_INVALID;
9975     }
9976     fullImpl->getNodeModifiers()->getImageModifier()->setAutoResize(
9977         node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
9978     return ERROR_CODE_NO_ERROR;
9979 }
9980 
SetAlt(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9981 int32_t SetAlt(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9982 {
9983     if (!item || (!item->string && !item->object)) {
9984         return ERROR_CODE_PARAM_INVALID;
9985     }
9986     auto* fullImpl = GetFullImpl();
9987     auto drawableDescriptor = reinterpret_cast<ArkUI_DrawableDescriptor*>(item->object);
9988     ArkUIImageSourceInfo imageInfo;
9989     imageInfo.url = item->string;
9990     node->altDrawableDescriptor = drawableDescriptor;
9991     if (drawableDescriptor && drawableDescriptor->resource) {
9992         imageInfo.resource = drawableDescriptor->resource.get();
9993     } else if (drawableDescriptor && drawableDescriptor->drawableDescriptor) {
9994         imageInfo.pixelMap = drawableDescriptor->drawableDescriptor.get();
9995     } else {
9996         node->altDrawableDescriptor = nullptr;
9997         if (!item->string) {
9998             return ERROR_CODE_PARAM_INVALID;
9999         }
10000     }
10001     imageInfo.pixelMapArray = nullptr;
10002     fullImpl->getNodeModifiers()->getImageModifier()->setAltSourceInfo(node->uiNodeHandle, &imageInfo);
10003     return ERROR_CODE_NO_ERROR;
10004 }
10005 
SetResizable(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10006 int32_t SetResizable(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10007 {
10008     auto actualSize = CheckAttributeItemArray(item, NUM_4);
10009     if (actualSize < 0) {
10010         return ERROR_CODE_PARAM_INVALID;
10011     }
10012     auto* fullImpl = GetFullImpl();
10013     fullImpl->getNodeModifiers()->getImageModifier()->setImageResizable(
10014         node->uiNodeHandle, item->value[NUM_0].f32, item->value[NUM_1].f32,
10015         item->value[NUM_2].f32, item->value[NUM_3].f32);
10016     return ERROR_CODE_NO_ERROR;
10017 }
10018 
ResetResizable(ArkUI_NodeHandle node)10019 void ResetResizable(ArkUI_NodeHandle node)
10020 {
10021     auto* fullImpl = GetFullImpl();
10022     fullImpl->getNodeModifiers()->getImageModifier()->setImageResizable(
10023         node->uiNodeHandle, 0.0f, 0.0f,
10024         0.0f, 0.0f);
10025 }
10026 
GetResizable(ArkUI_NodeHandle node)10027 const ArkUI_AttributeItem* GetResizable(ArkUI_NodeHandle node)
10028 {
10029     auto fullImpl = GetFullImpl();
10030     std::array<float, NUM_4> resizableArray;
10031     fullImpl->getNodeModifiers()->getImageModifier()->getImageResizable(
10032         node->uiNodeHandle, &resizableArray[0], NUM_4);
10033     g_numberValues[NUM_0].f32 = resizableArray[NUM_0];
10034     g_numberValues[NUM_1].f32 = resizableArray[NUM_1];
10035     g_numberValues[NUM_2].f32 = resizableArray[NUM_2];
10036     g_numberValues[NUM_3].f32 = resizableArray[NUM_3];
10037     g_attributeItem.size = NUM_4;
10038     return &g_attributeItem;
10039 }
10040 
SetImageDraggable(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10041 int32_t SetImageDraggable(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10042 {
10043     auto* fullImpl = GetFullImpl();
10044     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10045     if (actualSize < 0) {
10046         return ERROR_CODE_PARAM_INVALID;
10047     }
10048     fullImpl->getNodeModifiers()->getImageModifier()->setImageDraggable(
10049         node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
10050     return ERROR_CODE_NO_ERROR;
10051 }
10052 
SetRenderMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10053 int32_t SetRenderMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10054 {
10055     auto* fullImpl = GetFullImpl();
10056     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10057     if (actualSize < 0) {
10058         return ERROR_CODE_PARAM_INVALID;
10059     }
10060     if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_RENDER_MODE_TEMPLATE)) {
10061         return ERROR_CODE_PARAM_INVALID;
10062     }
10063     fullImpl->getNodeModifiers()->getImageModifier()->setRenderMode(node->uiNodeHandle, item->value[0].i32);
10064     return ERROR_CODE_NO_ERROR;
10065 }
10066 
ResetRenderMode(ArkUI_NodeHandle node)10067 void ResetRenderMode(ArkUI_NodeHandle node)
10068 {
10069     auto* fullImpl = GetFullImpl();
10070     fullImpl->getNodeModifiers()->getImageModifier()->resetRenderMode(node->uiNodeHandle);
10071 }
10072 
GetRenderMode(ArkUI_NodeHandle node)10073 const ArkUI_AttributeItem* GetRenderMode(ArkUI_NodeHandle node)
10074 {
10075     auto fullImpl = GetFullImpl();
10076     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getImageModifier()->getRenderMode(node->uiNodeHandle);
10077     g_attributeItem.size = REQUIRED_ONE_PARAM;
10078     return &g_attributeItem;
10079 }
10080 
SetFitOriginalSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10081 int32_t SetFitOriginalSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10082 {
10083     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10084     if (actualSize < 0) {
10085         return ERROR_CODE_PARAM_INVALID;
10086     }
10087     if (item->value[0].i32 < DEFAULT_FALSE || item->value[0].i32 > DEFAULT_TRUE) {
10088         return ERROR_CODE_PARAM_INVALID;
10089     }
10090     auto* fullImpl = GetFullImpl();
10091     fullImpl->getNodeModifiers()->getImageModifier()->setFitOriginalSize(
10092         node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
10093     return ERROR_CODE_NO_ERROR;
10094 }
10095 
ResetFitOriginalSize(ArkUI_NodeHandle node)10096 void ResetFitOriginalSize(ArkUI_NodeHandle node)
10097 {
10098     auto* fullImpl = GetFullImpl();
10099     fullImpl->getNodeModifiers()->getImageModifier()->resetFitOriginalSize(node->uiNodeHandle);
10100 }
10101 
GetFitOriginalSize(ArkUI_NodeHandle node)10102 const ArkUI_AttributeItem* GetFitOriginalSize(ArkUI_NodeHandle node)
10103 {
10104     auto* fullImpl = GetFullImpl();
10105     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getImageModifier()->getFitOriginalSize(node->uiNodeHandle);
10106     g_attributeItem.size = REQUIRED_ONE_PARAM;
10107     return &g_attributeItem;
10108 }
10109 
SetFillColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10110 int32_t SetFillColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10111 {
10112     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10113     if (actualSize < 0) {
10114         return ERROR_CODE_PARAM_INVALID;
10115     }
10116     auto* fullImpl = GetFullImpl();
10117     fullImpl->getNodeModifiers()->getImageModifier()->setFillColor(
10118         node->uiNodeHandle, static_cast<ArkUI_Uint32>(item->value[0].u32));
10119     return ERROR_CODE_NO_ERROR;
10120 }
10121 
ResetFillColor(ArkUI_NodeHandle node)10122 void ResetFillColor(ArkUI_NodeHandle node)
10123 {
10124     auto* fullImpl = GetFullImpl();
10125     fullImpl->getNodeModifiers()->getImageModifier()->resetFillColor(node->uiNodeHandle);
10126 }
10127 
GetFillColor(ArkUI_NodeHandle node)10128 const ArkUI_AttributeItem* GetFillColor(ArkUI_NodeHandle node)
10129 {
10130     auto* fullImpl = GetFullImpl();
10131     g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getImageModifier()->getFillColor(node->uiNodeHandle);
10132     g_attributeItem.size = REQUIRED_ONE_PARAM;
10133     return &g_attributeItem;
10134 }
10135 
SetHintRadius(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10136 int32_t SetHintRadius(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10137 {
10138     auto* fullImpl = GetFullImpl();
10139     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10140     if (actualSize < 0) {
10141         return ERROR_CODE_PARAM_INVALID;
10142     }
10143     if (LessNotEqual(item->value[0].f32, 0.0f)) {
10144         return ERROR_CODE_PARAM_INVALID;
10145     }
10146     fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setHintRadius(
10147         node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_VP));
10148     return ERROR_CODE_NO_ERROR;
10149 }
10150 
GetHintRadius(ArkUI_NodeHandle node)10151 const ArkUI_AttributeItem* GetHintRadius(ArkUI_NodeHandle node)
10152 {
10153     auto fullImpl = GetFullImpl();
10154     g_numberValues[0].f32 =
10155         fullImpl->getNodeModifiers()->getCalendarPickerModifier()->getHintRadius(node->uiNodeHandle);
10156     g_attributeItem.size = REQUIRED_ONE_PARAM;
10157     return &g_attributeItem;
10158 }
10159 
SetSelectedDate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10160 int32_t SetSelectedDate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10161 {
10162     auto* fullImpl = GetFullImpl();
10163     auto actualSize = CheckAttributeItemArray(item, REQUIRED_THREE_PARAM);
10164     if (actualSize < 0) {
10165         return ERROR_CODE_PARAM_INVALID;
10166     }
10167     if (!IsValidDate(item->value[SELECTED_YEAR_INDEX].u32,
10168         item->value[SELECTED_MONTH_INDEX].u32, item->value[SELECTED_DAY_INDEX].u32)) {
10169         return ERROR_CODE_PARAM_INVALID;
10170     }
10171     uint32_t selectedYear = item->value[SELECTED_YEAR_INDEX].u32;
10172     uint32_t selectedMonth = item->value[SELECTED_MONTH_INDEX].u32;
10173     uint32_t selectedDay = item->value[SELECTED_DAY_INDEX].u32;
10174     fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setSelectDate(
10175         node->uiNodeHandle, selectedYear, selectedMonth, selectedDay);
10176     return ERROR_CODE_NO_ERROR;
10177 }
10178 
GetSelectedDate(ArkUI_NodeHandle node)10179 const ArkUI_AttributeItem* GetSelectedDate(ArkUI_NodeHandle node)
10180 {
10181     auto fullImpl = GetFullImpl();
10182     auto selectedDate = fullImpl->getNodeModifiers()->getCalendarPickerModifier()->getSelectedDate(node->uiNodeHandle);
10183     g_numberValues[SELECTED_YEAR_INDEX].u32 = selectedDate.year;
10184     g_numberValues[SELECTED_MONTH_INDEX].u32 = selectedDate.month;
10185     g_numberValues[SELECTED_DAY_INDEX].u32 = selectedDate.day;
10186     g_attributeItem.size = REQUIRED_THREE_PARAM;
10187     return &g_attributeItem;
10188 }
10189 
SetEdgeAlignment(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10190 int32_t SetEdgeAlignment(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10191 {
10192     auto* fullImpl = GetFullImpl();
10193     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10194     if (actualSize < 0) {
10195         return ERROR_CODE_PARAM_INVALID;
10196     }
10197     if (EDGE_TYPE_INDEX < actualSize &&
10198         (item->value[EDGE_TYPE_INDEX].i32 < static_cast<int32_t>(ARKUI_CALENDAR_ALIGNMENT_START) ||
10199             item->value[EDGE_TYPE_INDEX].i32 > static_cast<int32_t>(ARKUI_CALENDAR_ALIGNMENT_END))) {
10200         return ERROR_CODE_PARAM_INVALID;
10201     }
10202     int32_t defaultAlignment = 0;
10203     if (EDGE_TYPE_INDEX < actualSize) {
10204         defaultAlignment = item->value[EDGE_TYPE_INDEX].i32;
10205     }
10206     std::vector<float> sizeArray;
10207     float xOffset = 0.0f;
10208     if (EDGE_OFFSET_X_INDEX < actualSize) {
10209         xOffset = item->value[EDGE_OFFSET_X_INDEX].f32;
10210     }
10211     sizeArray.emplace_back(xOffset);
10212     float yOffset = 0.0f;
10213     if (EDGE_OFFSET_Y_INDEX < actualSize) {
10214         yOffset = item->value[EDGE_OFFSET_Y_INDEX].f32;
10215     }
10216     sizeArray.emplace_back(yOffset);
10217     int32_t unit = GetDefaultUnit(node, UNIT_VP);
10218     std::vector<int32_t> unitArray = { unit, unit };
10219     fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setEdgeAlign(
10220         node->uiNodeHandle, &sizeArray[0], &unitArray[0], static_cast<int32_t>(sizeArray.size()), defaultAlignment);
10221     return ERROR_CODE_NO_ERROR;
10222 }
10223 
GetEdgeAlignment(ArkUI_NodeHandle node)10224 const ArkUI_AttributeItem* GetEdgeAlignment(ArkUI_NodeHandle node)
10225 {
10226     auto fullImpl = GetFullImpl();
10227     auto edgeAlign = fullImpl->getNodeModifiers()->getCalendarPickerModifier()->getEdgeAlign(node->uiNodeHandle);
10228     g_numberValues[EDGE_TYPE_INDEX].i32 = edgeAlign.alignType;
10229     g_numberValues[EDGE_OFFSET_X_INDEX].f32 = edgeAlign.offsetX;
10230     g_numberValues[EDGE_OFFSET_Y_INDEX].f32 = edgeAlign.offsetY;
10231     g_attributeItem.size = REQUIRED_THREE_PARAM;
10232     return &g_attributeItem;
10233 }
10234 
SetCalendarPickerTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10235 int32_t SetCalendarPickerTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10236 {
10237     auto* fullImpl = GetFullImpl();
10238     auto actualSize = CheckAttributeItemArray(item, 0);
10239     if (actualSize < 0) {
10240         return ERROR_CODE_PARAM_INVALID;
10241     }
10242     if (CALENDAR_PICKER_FONT_SIZE_INDEX < actualSize &&
10243         LessNotEqual(item->value[CALENDAR_PICKER_FONT_SIZE_INDEX].f32, 0.0f)) {
10244         return ERROR_CODE_PARAM_INVALID;
10245     }
10246     if (CALENDAR_PICKER_FONT_WEIGHT_INDEX < actualSize &&
10247         (item->value[CALENDAR_PICKER_FONT_WEIGHT_INDEX].i32 < 0 ||
10248             item->value[CALENDAR_PICKER_FONT_WEIGHT_INDEX].i32 > static_cast<int32_t>(ARKUI_FONT_WEIGHT_REGULAR))) {
10249         return ERROR_CODE_PARAM_INVALID;
10250     }
10251     uint32_t fontColor = Color::BLACK.GetValue();
10252     if (CALENDAR_PICKER_FONT_COLOR_INDEX < actualSize) {
10253         fontColor = item->value[CALENDAR_PICKER_FONT_COLOR_INDEX].u32;
10254     }
10255     float fontSize = 0.0f;
10256     std::vector<float> fontSizeArray;
10257     if (CALENDAR_PICKER_FONT_SIZE_INDEX < actualSize) {
10258         fontSize = item->value[CALENDAR_PICKER_FONT_SIZE_INDEX].f32;
10259     }
10260     int32_t unit = GetDefaultUnit(node, UNIT_VP);
10261     fontSizeArray.emplace_back(fontSize);
10262     fontSizeArray.emplace_back(static_cast<float>(unit));
10263     int32_t fontWeight = 0;
10264     if (CALENDAR_PICKER_FONT_WEIGHT_INDEX < actualSize) {
10265         fontWeight = item->value[CALENDAR_PICKER_FONT_WEIGHT_INDEX].i32;
10266     }
10267     fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setTextStyleWithWeightEnum(
10268         node->uiNodeHandle, fontColor, fontSize, unit, fontWeight);
10269     return ERROR_CODE_NO_ERROR;
10270 }
10271 
GetCalendarPickerTextStyle(ArkUI_NodeHandle node)10272 const ArkUI_AttributeItem* GetCalendarPickerTextStyle(ArkUI_NodeHandle node)
10273 {
10274     auto fullImpl = GetFullImpl();
10275     auto textStyle =
10276         fullImpl->getNodeModifiers()->getCalendarPickerModifier()->getCalendarPickerTextStyle(node->uiNodeHandle);
10277     g_numberValues[CALENDAR_PICKER_FONT_COLOR_INDEX].u32 = textStyle.fontColor;
10278     g_numberValues[CALENDAR_PICKER_FONT_SIZE_INDEX].f32 = textStyle.fontSize;
10279     g_numberValues[CALENDAR_PICKER_FONT_WEIGHT_INDEX].i32 = textStyle.fontWeight;
10280     g_attributeItem.size = REQUIRED_THREE_PARAM;
10281     return &g_attributeItem;
10282 }
10283 
ResetHintRadius(ArkUI_NodeHandle node)10284 void ResetHintRadius(ArkUI_NodeHandle node)
10285 {
10286     auto* fullImpl = GetFullImpl();
10287     fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setHintRadius(
10288         node->uiNodeHandle, DEFAULT_HINT_RADIUS, UNIT_VP);
10289 }
10290 
ResetSelectedDate(ArkUI_NodeHandle node)10291 void ResetSelectedDate(ArkUI_NodeHandle node)
10292 {
10293     auto* fullImpl = GetFullImpl();
10294     fullImpl->getNodeModifiers()->getCalendarPickerModifier()->resetSelectDate(node->uiNodeHandle);
10295 }
10296 
ResetEdgeAlignment(ArkUI_NodeHandle node)10297 void ResetEdgeAlignment(ArkUI_NodeHandle node)
10298 {
10299     auto* fullImpl = GetFullImpl();
10300     fullImpl->getNodeModifiers()->getCalendarPickerModifier()->resetEdgeAlign(node->uiNodeHandle);
10301 }
10302 
ResetCalendarPickerTextStyle(ArkUI_NodeHandle node)10303 void ResetCalendarPickerTextStyle(ArkUI_NodeHandle node)
10304 {
10305     auto* fullImpl = GetFullImpl();
10306     fullImpl->getNodeModifiers()->getCalendarPickerModifier()->resetTextStyle(node->uiNodeHandle);
10307 }
10308 
ResetBackgroundImageSize(ArkUI_NodeHandle node)10309 void ResetBackgroundImageSize(ArkUI_NodeHandle node)
10310 {
10311     auto* fullImpl = GetFullImpl();
10312     fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundImageSize(node->uiNodeHandle);
10313 }
10314 
ResetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node)10315 void ResetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node)
10316 {
10317     ResetBackgroundImageSize(node);
10318 }
10319 
ResetBackgroundBlurStyle(ArkUI_NodeHandle node)10320 void ResetBackgroundBlurStyle(ArkUI_NodeHandle node)
10321 {
10322     auto* fullImpl = GetFullImpl();
10323     fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundBlurStyle(node->uiNodeHandle);
10324 }
10325 
ResetTransformCenter(ArkUI_NodeHandle node)10326 void ResetTransformCenter(ArkUI_NodeHandle node)
10327 {
10328     auto* fullImpl = GetFullImpl();
10329     CalcDimension centerX(HALF, DimensionUnit::PERCENT);
10330     CalcDimension centerY(HALF, DimensionUnit::PERCENT);
10331     CalcDimension centerZ(0, DimensionUnit::VP);
10332     fullImpl->getNodeModifiers()->getCommonModifier()->setTransitionCenter(node->uiNodeHandle, centerX.Value(),
10333         static_cast<int32_t>(centerX.Unit()), centerY.Value(), static_cast<int32_t>(centerY.Unit()), centerZ.Value(),
10334         static_cast<int32_t>(centerZ.Unit()));
10335 }
10336 
ResetOpacityTransition(ArkUI_NodeHandle node)10337 void ResetOpacityTransition(ArkUI_NodeHandle node)
10338 {
10339     auto* fullImpl = GetFullImpl();
10340     ArkUIAnimationOptionType animationOption;
10341     ResetAnimation(animationOption);
10342     fullImpl->getNodeModifiers()->getCommonModifier()->setOpacityTransition(
10343         node->uiNodeHandle, DEFAULT_OPACITY, &animationOption);
10344 }
10345 
ResetRotateTransition(ArkUI_NodeHandle node)10346 void ResetRotateTransition(ArkUI_NodeHandle node)
10347 {
10348     auto* fullImpl = GetFullImpl();
10349     std::array<float, ARRAY_SIZE> rotateArray;
10350     ArkUIAnimationOptionType animationOption;
10351     ResetAnimation(animationOption);
10352     fullImpl->getNodeModifiers()->getCommonModifier()->setRotateTransition(
10353         node->uiNodeHandle, &rotateArray[0], ARRAY_SIZE, 0.0f, 0.0f, &animationOption);
10354 }
10355 
ResetScaleTransition(ArkUI_NodeHandle node)10356 void ResetScaleTransition(ArkUI_NodeHandle node)
10357 {
10358     auto* fullImpl = GetFullImpl();
10359     std::array<float, ARRAY_SIZE> scaleFloatArray;
10360     ArkUIAnimationOptionType animationOption;
10361     ResetAnimation(animationOption);
10362     fullImpl->getNodeModifiers()->getCommonModifier()->setScaleTransition(
10363         node->uiNodeHandle, &scaleFloatArray[0], scaleFloatArray.size(), &animationOption);
10364 }
10365 
ResetTranslateTransition(ArkUI_NodeHandle node)10366 void ResetTranslateTransition(ArkUI_NodeHandle node)
10367 {
10368     auto* fullImpl = GetFullImpl();
10369     std::array<float, ARRAY_SIZE> scaleFloatArray;
10370     ArkUIAnimationOptionType animationOption;
10371     ResetAnimation(animationOption);
10372     fullImpl->getNodeModifiers()->getCommonModifier()->setScaleTransition(
10373         node->uiNodeHandle, &scaleFloatArray[0], scaleFloatArray.size(), &animationOption);
10374     fullImpl->getNodeModifiers()->getCommonModifier()->setTranslateTransition(node->uiNodeHandle, 0.0f,
10375         UNIT_VP, 0.0f, UNIT_VP, 0.0f,
10376         UNIT_VP, &animationOption);
10377 }
10378 
ResetMoveTransition(ArkUI_NodeHandle node)10379 void ResetMoveTransition(ArkUI_NodeHandle node)
10380 {
10381     auto* fullImpl = GetFullImpl();
10382     ArkUIAnimationOptionType animationOption;
10383     ResetAnimation(animationOption);
10384     fullImpl->getNodeModifiers()->getCommonModifier()->setMoveTransition(
10385         node->uiNodeHandle, ARKUI_TRANSITION_EDGE_TOP, &animationOption);
10386 }
10387 
ResetOffset(ArkUI_NodeHandle node)10388 void ResetOffset(ArkUI_NodeHandle node)
10389 {
10390     auto* fullImpl = GetFullImpl();
10391     fullImpl->getNodeModifiers()->getCommonModifier()->resetOffset(node->uiNodeHandle);
10392 }
10393 
ResetMarkAnchor(ArkUI_NodeHandle node)10394 void ResetMarkAnchor(ArkUI_NodeHandle node)
10395 {
10396     auto* fullImpl = GetFullImpl();
10397     fullImpl->getNodeModifiers()->getCommonModifier()->resetMarkAnchor(node->uiNodeHandle);
10398 }
10399 
ResetTextContent(ArkUI_NodeHandle node)10400 void ResetTextContent(ArkUI_NodeHandle node)
10401 {
10402     auto* fullImpl = GetFullImpl();
10403     fullImpl->getNodeModifiers()->getTextModifier()->setContent(node->uiNodeHandle, "");
10404 }
10405 
ResetLineHeight(ArkUI_NodeHandle node)10406 void ResetLineHeight(ArkUI_NodeHandle node)
10407 {
10408     auto fullImpl = GetFullImpl();
10409     switch (node->type) {
10410         case ARKUI_NODE_TEXT:
10411             fullImpl->getNodeModifiers()->getTextModifier()->resetTextLineHeight(node->uiNodeHandle);
10412             break;
10413         case ARKUI_NODE_SPAN:
10414             fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanLineHeight(node->uiNodeHandle);
10415             break;
10416         case ARKUI_NODE_TEXT_INPUT:
10417             fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputLineHeight(node->uiNodeHandle);
10418             break;
10419         case ARKUI_NODE_TEXT_AREA:
10420             fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaLineHeight(node->uiNodeHandle);
10421             break;
10422         default:
10423             break;
10424     }
10425 }
10426 
ResetDecoration(ArkUI_NodeHandle node)10427 void ResetDecoration(ArkUI_NodeHandle node)
10428 {
10429     auto fullImpl = GetFullImpl();
10430     switch (node->type) {
10431         case ARKUI_NODE_SPAN:
10432             fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanDecoration(node->uiNodeHandle);
10433             break;
10434         case ARKUI_NODE_TEXT:
10435             fullImpl->getNodeModifiers()->getTextModifier()->resetTextDecoration(node->uiNodeHandle);
10436             break;
10437         default:
10438             break;
10439     }
10440 }
10441 
ResetTextCase(ArkUI_NodeHandle node)10442 void ResetTextCase(ArkUI_NodeHandle node)
10443 {
10444     auto fullImpl = GetFullImpl();
10445     switch (node->type) {
10446         case ARKUI_NODE_SPAN:
10447             fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanTextCase(node->uiNodeHandle);
10448             break;
10449         case ARKUI_NODE_TEXT:
10450             fullImpl->getNodeModifiers()->getTextModifier()->resetTextCase(node->uiNodeHandle);
10451             break;
10452         default:
10453             break;
10454     }
10455 }
10456 
ResetLetterSpacing(ArkUI_NodeHandle node)10457 void ResetLetterSpacing(ArkUI_NodeHandle node)
10458 {
10459     auto fullImpl = GetFullImpl();
10460     switch (node->type) {
10461         case ARKUI_NODE_SPAN:
10462             fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanLetterSpacing(node->uiNodeHandle);
10463             break;
10464         case ARKUI_NODE_TEXT:
10465             fullImpl->getNodeModifiers()->getTextModifier()->resetTextLetterSpacing(node->uiNodeHandle);
10466             break;
10467         default:
10468             break;
10469     }
10470 }
10471 
ResetMaxLines(ArkUI_NodeHandle node)10472 void ResetMaxLines(ArkUI_NodeHandle node)
10473 {
10474     auto fullImpl = GetFullImpl();
10475     switch (node->type) {
10476         case ARKUI_NODE_TEXT:
10477             fullImpl->getNodeModifiers()->getTextModifier()->resetTextMaxLines(node->uiNodeHandle);
10478             break;
10479         case ARKUI_NODE_TEXT_INPUT:
10480             fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputMaxLines(node->uiNodeHandle);
10481             break;
10482         case ARKUI_NODE_TEXT_AREA:
10483             fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaMaxLines(node->uiNodeHandle);
10484             break;
10485         default:
10486             break;
10487     }
10488 }
10489 
ResetTextAlign(ArkUI_NodeHandle node)10490 void ResetTextAlign(ArkUI_NodeHandle node)
10491 {
10492     auto fullImpl = GetFullImpl();
10493     switch (node->type) {
10494         case ARKUI_NODE_TEXT_INPUT:
10495             fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputTextAlign(node->uiNodeHandle);
10496             break;
10497         case ARKUI_NODE_TEXT:
10498             fullImpl->getNodeModifiers()->getTextModifier()->resetTextAlign(node->uiNodeHandle);
10499             break;
10500         case ARKUI_NODE_TEXT_AREA:
10501             fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaTextAlign(node->uiNodeHandle);
10502             break;
10503         default:
10504             break;
10505     }
10506 }
10507 
ResetTextOverflow(ArkUI_NodeHandle node)10508 void ResetTextOverflow(ArkUI_NodeHandle node)
10509 {
10510     auto fullImpl = GetFullImpl();
10511     fullImpl->getNodeModifiers()->getTextModifier()->resetTextOverflow(node->uiNodeHandle);
10512 }
10513 
ResetSpanContent(ArkUI_NodeHandle node)10514 void ResetSpanContent(ArkUI_NodeHandle node)
10515 {
10516     auto fullImpl = GetFullImpl();
10517     fullImpl->getNodeModifiers()->getSpanModifier()->setContent(node->uiNodeHandle, "");
10518 }
10519 
ResetSpanTextBackgroundStyle(ArkUI_NodeHandle node)10520 void ResetSpanTextBackgroundStyle(ArkUI_NodeHandle node)
10521 {
10522     auto fullImpl = GetFullImpl();
10523     fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanTextBackgroundStyle(node->uiNodeHandle);
10524 }
10525 
ResetImageSpanSrc(ArkUI_NodeHandle node)10526 void ResetImageSpanSrc(ArkUI_NodeHandle node)
10527 {
10528     auto fullImpl = GetFullImpl();
10529     fullImpl->getNodeModifiers()->getImageModifier()->setSrc(node->uiNodeHandle, "");
10530 }
10531 
ResetVerticalAlign(ArkUI_NodeHandle node)10532 void ResetVerticalAlign(ArkUI_NodeHandle node)
10533 {
10534     auto fullImpl = GetFullImpl();
10535     fullImpl->getNodeModifiers()->getImageSpanModifier()->resetImageSpanVerticalAlign(
10536         node->uiNodeHandle);
10537 }
10538 
ResetImageSrc(ArkUI_NodeHandle node)10539 void ResetImageSrc(ArkUI_NodeHandle node)
10540 {
10541     auto fullImpl = GetFullImpl();
10542     fullImpl->getNodeModifiers()->getImageModifier()->resetImageSrc(node->uiNodeHandle);
10543 }
10544 
ResetObjectFit(ArkUI_NodeHandle node)10545 void ResetObjectFit(ArkUI_NodeHandle node)
10546 {
10547     auto fullImpl = GetFullImpl();
10548     fullImpl->getNodeModifiers()->getImageModifier()->resetObjectFit(node->uiNodeHandle);
10549 }
10550 
ResetInterpolation(ArkUI_NodeHandle node)10551 void ResetInterpolation(ArkUI_NodeHandle node)
10552 {
10553     auto fullImpl = GetFullImpl();
10554     fullImpl->getNodeModifiers()->getImageModifier()->resetImageInterpolation(node->uiNodeHandle);
10555 }
10556 
ResetObjectRepeat(ArkUI_NodeHandle node)10557 void ResetObjectRepeat(ArkUI_NodeHandle node)
10558 {
10559     auto fullImpl = GetFullImpl();
10560     fullImpl->getNodeModifiers()->getImageModifier()->resetObjectRepeat(node->uiNodeHandle);
10561 }
10562 
ResetColorFilter(ArkUI_NodeHandle node)10563 void ResetColorFilter(ArkUI_NodeHandle node)
10564 {
10565     auto fullImpl = GetFullImpl();
10566     fullImpl->getNodeModifiers()->getImageModifier()->resetColorFilter(node->uiNodeHandle);
10567 }
10568 
ResetAutoResize(ArkUI_NodeHandle node)10569 void ResetAutoResize(ArkUI_NodeHandle node)
10570 {
10571     auto fullImpl = GetFullImpl();
10572     fullImpl->getNodeModifiers()->getImageModifier()->resetAutoResize(node->uiNodeHandle);
10573 }
10574 
ResetAlt(ArkUI_NodeHandle node)10575 void ResetAlt(ArkUI_NodeHandle node)
10576 {
10577     auto fullImpl = GetFullImpl();
10578     fullImpl->getNodeModifiers()->getImageModifier()->resetAlt(node->uiNodeHandle);
10579 }
10580 
ResetImageDraggable(ArkUI_NodeHandle node)10581 void ResetImageDraggable(ArkUI_NodeHandle node)
10582 {
10583     auto fullImpl = GetFullImpl();
10584     fullImpl->getNodeModifiers()->getImageModifier()->resetImageDraggable(node->uiNodeHandle);
10585 }
10586 
GetBackgroundImageSize(ArkUI_NodeHandle node)10587 const ArkUI_AttributeItem* GetBackgroundImageSize(ArkUI_NodeHandle node)
10588 {
10589     auto fullImpl = GetFullImpl();
10590     auto backGroundImageSize =
10591         fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImageSize(
10592             node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
10593     g_numberValues[BACKGROUND_IMAGE_WIDTH_INDEX].f32 = backGroundImageSize.xValue;
10594     g_numberValues[BACKGROUND_IMAGE_HEIGHT_INDEX].f32 = backGroundImageSize.yValue;
10595     g_attributeItem.size = REQUIRED_TWO_PARAM;
10596     return &g_attributeItem;
10597 }
10598 
GetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node)10599 const ArkUI_AttributeItem* GetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node)
10600 {
10601     auto fullImpl = GetFullImpl();
10602     g_numberValues[0].i32 =
10603         fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImageSizeWithStyle(node->uiNodeHandle);
10604     g_attributeItem.size = REQUIRED_ONE_PARAM;
10605     return &g_attributeItem;
10606 }
10607 
GetBackgroundBlurStyle(ArkUI_NodeHandle node)10608 const ArkUI_AttributeItem* GetBackgroundBlurStyle(ArkUI_NodeHandle node)
10609 {
10610     auto fullImpl = GetFullImpl();
10611     auto backGroundBlurStyle =
10612         fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundBlurStyle(node->uiNodeHandle);
10613     g_numberValues[BLUR_STYLE_INDEX].i32 = UnConvertBlurStyle(backGroundBlurStyle.blurStyle);
10614     g_numberValues[COLOR_MODE_INDEX].i32 = backGroundBlurStyle.colorMode;
10615     g_numberValues[ADAPTIVE_COLOR_INDEX].i32 = backGroundBlurStyle.adaptiveColor;
10616     g_numberValues[SCALE_INDEX].f32 = backGroundBlurStyle.scale;
10617     g_numberValues[GRAY_SCALE_START].f32 = backGroundBlurStyle.grayScaleStart;
10618     g_numberValues[GRAY_SCALE_END].f32 = backGroundBlurStyle.grayScaleEnd;
10619     g_attributeItem.size = NUM_6;
10620     return &g_attributeItem;
10621 }
10622 
GetTransformCenter(ArkUI_NodeHandle node)10623 const ArkUI_AttributeItem* GetTransformCenter(ArkUI_NodeHandle node)
10624 {
10625     auto fullImpl = GetFullImpl();
10626     auto transformCenter = fullImpl->getNodeModifiers()->getCommonModifier()->getTransformCenter(node->uiNodeHandle);
10627     g_numberValues[CENTER_X_INDEX].f32 = transformCenter.centerX;
10628     g_numberValues[CENTER_Y_INDEX].f32 = transformCenter.centerY;
10629     g_numberValues[CENTER_Z_INDEX].f32 = transformCenter.centerZ;
10630     g_attributeItem.size = REQUIRED_THREE_PARAM;
10631     return &g_attributeItem;
10632 }
10633 
GetOpacityTransition(ArkUI_NodeHandle node)10634 const ArkUI_AttributeItem* GetOpacityTransition(ArkUI_NodeHandle node)
10635 {
10636     auto fullImpl = GetFullImpl();
10637     auto opacityTransition =
10638         fullImpl->getNodeModifiers()->getCommonModifier()->getOpacityTransition(node->uiNodeHandle);
10639     const int32_t animationDurationIndex = OPACITY_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10640     const int32_t animationCurveIndex = OPACITY_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10641     const int32_t animationDelayIndex = OPACITY_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10642     const int32_t animationIterationsIndex = OPACITY_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10643     const int32_t animationPlayModeIndex = OPACITY_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10644     const int32_t animationTempoIndex = OPACITY_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10645     g_numberValues[0].f32 = opacityTransition.opacity;
10646     g_numberValues[animationDurationIndex].i32 = opacityTransition.animation.duration;
10647     g_numberValues[animationCurveIndex].i32 = opacityTransition.animation.curve;
10648     g_numberValues[animationDelayIndex].i32 = opacityTransition.animation.delay;
10649     g_numberValues[animationIterationsIndex].i32 = opacityTransition.animation.iteration;
10650     g_numberValues[animationPlayModeIndex].i32 =UnConvertAnimationDirection(opacityTransition.animation.playMode);
10651     g_numberValues[animationTempoIndex].f32 = opacityTransition.animation.tempo;
10652     g_attributeItem.size = REQUIRED_SEVEN_PARAM;
10653     return &g_attributeItem;
10654 }
10655 
GetRotateTransition(ArkUI_NodeHandle node)10656 const ArkUI_AttributeItem* GetRotateTransition(ArkUI_NodeHandle node)
10657 {
10658     auto fullImpl = GetFullImpl();
10659     auto rotateTransition = fullImpl->getNodeModifiers()->getCommonModifier()->getRotateTransition(node->uiNodeHandle);
10660     const int32_t animationDurationIndex = ROTATE_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10661     const int32_t animationCurveIndex = ROTATE_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10662     const int32_t animationDelayIndex = ROTATE_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10663     const int32_t animationIterationsIndex = ROTATE_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10664     const int32_t animationPlayModeIndex = ROTATE_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10665     const int32_t animationTempoIndex = ROTATE_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10666     g_numberValues[X_INDEX].f32 = rotateTransition.xRotation;
10667     g_numberValues[Y_INDEX].f32 = rotateTransition.yRotation;
10668     g_numberValues[Z_INDEX].f32 = rotateTransition.zRotation;
10669     g_numberValues[ROTATE_ANGLE_INDEX].f32 = rotateTransition.angle;
10670     g_numberValues[ROTATE_PERSPECTIVE_INDEX].f32 = rotateTransition.perspective;
10671     g_numberValues[animationDurationIndex].i32 = rotateTransition.animation.duration;
10672     g_numberValues[animationCurveIndex].i32 = rotateTransition.animation.curve;
10673     g_numberValues[animationDelayIndex].i32 = rotateTransition.animation.delay;
10674     g_numberValues[animationIterationsIndex].i32 = rotateTransition.animation.iteration;
10675     g_numberValues[animationPlayModeIndex].i32 = UnConvertAnimationDirection(rotateTransition.animation.playMode);
10676     g_numberValues[animationTempoIndex].f32 = rotateTransition.animation.tempo;
10677     g_attributeItem.size = NUM_11;
10678     return &g_attributeItem;
10679 }
10680 
GetScaleTransition(ArkUI_NodeHandle node)10681 const ArkUI_AttributeItem* GetScaleTransition(ArkUI_NodeHandle node)
10682 {
10683     auto fullImpl = GetFullImpl();
10684     auto scaleTransition = fullImpl->getNodeModifiers()->getCommonModifier()->getScaleTransition(node->uiNodeHandle);
10685     const int32_t animationDurationIndex = SCALE_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10686     const int32_t animationCurveIndex = SCALE_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10687     const int32_t animationDelayIndex = SCALE_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10688     const int32_t animationIterationsIndex = SCALE_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10689     const int32_t animationPlayModeIndex = SCALE_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10690     const int32_t animationTempoIndex = SCALE_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10691     g_numberValues[X_INDEX].f32 = scaleTransition.xScale;
10692     g_numberValues[Y_INDEX].f32 = scaleTransition.yScale;
10693     g_numberValues[Z_INDEX].f32 = scaleTransition.zScale;
10694     g_numberValues[animationDurationIndex].i32 = scaleTransition.animation.duration;
10695     g_numberValues[animationCurveIndex].i32 = scaleTransition.animation.curve;
10696     g_numberValues[animationDelayIndex].i32 = scaleTransition.animation.delay;
10697     g_numberValues[animationIterationsIndex].i32 = scaleTransition.animation.iteration;
10698     g_numberValues[animationPlayModeIndex].i32 = UnConvertAnimationDirection(scaleTransition.animation.playMode);
10699     g_numberValues[animationTempoIndex].f32 = scaleTransition.animation.tempo;
10700     g_attributeItem.size = NUM_9;
10701     return &g_attributeItem;
10702 }
10703 
GetTranslateTransition(ArkUI_NodeHandle node)10704 const ArkUI_AttributeItem* GetTranslateTransition(ArkUI_NodeHandle node)
10705 {
10706     auto fullImpl = GetFullImpl();
10707     auto translateTransition =
10708         fullImpl->getNodeModifiers()->getCommonModifier()->getTranslateTransition(node->uiNodeHandle);
10709     const int32_t animationDurationIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10710     const int32_t animationCurveIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10711     const int32_t animationDelayIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10712     const int32_t animationIterationsIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10713     const int32_t animationPlayModeIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10714     const int32_t animationTempoIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10715     g_numberValues[X_INDEX].f32 = translateTransition.xTransition;
10716     g_numberValues[Y_INDEX].f32 = translateTransition.yTransition;
10717     g_numberValues[Z_INDEX].f32 = translateTransition.zTransition;
10718     g_numberValues[animationDurationIndex].i32 = translateTransition.animation.duration;
10719     g_numberValues[animationCurveIndex].i32 = translateTransition.animation.curve;
10720     g_numberValues[animationDelayIndex].i32 = translateTransition.animation.delay;
10721     g_numberValues[animationIterationsIndex].i32 = translateTransition.animation.iteration;
10722     g_numberValues[animationPlayModeIndex].i32 = UnConvertAnimationDirection(translateTransition.animation.playMode);
10723     g_numberValues[animationTempoIndex].f32 = translateTransition.animation.tempo;
10724     return &g_attributeItem;
10725 }
10726 
GetMoveTransition(ArkUI_NodeHandle node)10727 const ArkUI_AttributeItem* GetMoveTransition(ArkUI_NodeHandle node)
10728 {
10729     auto fullImpl = GetFullImpl();
10730     auto moveTransition =
10731         fullImpl->getNodeModifiers()->getCommonModifier()->getMoveTransition(node->uiNodeHandle);
10732     const int32_t animationDurationIndex = MOVE_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10733     const int32_t animationCurveIndex = MOVE_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10734     const int32_t animationDelayIndex = MOVE_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10735     const int32_t animationIterationsIndex = MOVE_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10736     const int32_t animationPlayModeIndex = MOVE_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10737     const int32_t animationTempoIndex = MOVE_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10738     g_numberValues[0].i32 = moveTransition.edgeType;
10739     g_numberValues[animationDurationIndex].i32 = moveTransition.animation.duration;
10740     g_numberValues[animationCurveIndex].i32 = moveTransition.animation.curve;
10741     g_numberValues[animationDelayIndex].i32 = moveTransition.animation.delay;
10742     g_numberValues[animationIterationsIndex].i32 = moveTransition.animation.iteration;
10743     g_numberValues[animationPlayModeIndex].i32 = moveTransition.animation.playMode;
10744     g_numberValues[animationTempoIndex].f32 = moveTransition.animation.tempo;
10745     g_attributeItem.size = REQUIRED_SEVEN_PARAM;
10746     return &g_attributeItem;
10747 }
10748 
10749 
GetOffset(ArkUI_NodeHandle node)10750 const ArkUI_AttributeItem* GetOffset(ArkUI_NodeHandle node)
10751 {
10752     auto fullImpl = GetFullImpl();
10753     auto offset = fullImpl->getNodeModifiers()->getCommonModifier()->getOffset(node->uiNodeHandle);
10754     g_numberValues[NUM_0].f32 = offset.xComponent;
10755     g_numberValues[NUM_1].f32 = offset.yComponent;
10756     g_attributeItem.size = REQUIRED_TWO_PARAM;
10757     return &g_attributeItem;
10758 }
10759 
GetMarkAnchor(ArkUI_NodeHandle node)10760 const ArkUI_AttributeItem* GetMarkAnchor(ArkUI_NodeHandle node)
10761 {
10762     auto fullImpl = GetFullImpl();
10763     auto markAnchor = fullImpl->getNodeModifiers()->getCommonModifier()->getMarkAnchor(node->uiNodeHandle);
10764     g_numberValues[NUM_0].f32 = markAnchor.xCoordinate;
10765     g_numberValues[NUM_1].f32 = markAnchor.yCoordinate;
10766     g_attributeItem.size = REQUIRED_TWO_PARAM;
10767     return &g_attributeItem;
10768 }
10769 
GetAlignRules(ArkUI_NodeHandle node)10770 const ArkUI_AttributeItem* GetAlignRules(ArkUI_NodeHandle node)
10771 {
10772     g_attributeItem.object = node->alignRuleOption;
10773     return &g_attributeItem;
10774 }
10775 
GetTextContent(ArkUI_NodeHandle node)10776 const ArkUI_AttributeItem* GetTextContent(ArkUI_NodeHandle node)
10777 {
10778     auto fullImpl = GetFullImpl();
10779     auto textContent = fullImpl->getNodeModifiers()->getTextModifier()->getTextContent(node->uiNodeHandle);
10780     g_attributeItem.string = (textContent != nullptr ? textContent : EMPTY_STR.c_str());
10781     return &g_attributeItem;
10782 }
10783 
GetFontColor(ArkUI_NodeHandle node)10784 const ArkUI_AttributeItem* GetFontColor(ArkUI_NodeHandle node)
10785 {
10786     auto fullImpl = GetFullImpl();
10787     switch (node->type) {
10788         case ARKUI_NODE_TEXT:
10789             g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getTextModifier()->
10790                 getFontColor(node->uiNodeHandle);
10791             g_attributeItem.size = REQUIRED_ONE_PARAM;
10792             break;
10793         case ARKUI_NODE_SPAN:
10794             g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getSpanModifier()->
10795                 getSpanFontColor(node->uiNodeHandle);
10796             g_attributeItem.size = REQUIRED_ONE_PARAM;
10797             break;
10798         case ARKUI_NODE_TEXT_INPUT:
10799         case ARKUI_NODE_TEXT_AREA:
10800             g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
10801                 getTextInputFontColor(node->uiNodeHandle);
10802             g_attributeItem.size = REQUIRED_ONE_PARAM;
10803             break;
10804         case ARKUI_NODE_BUTTON:
10805             g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getButtonModifier()->
10806                 getButtonFontColor(node->uiNodeHandle);
10807             g_attributeItem.size = REQUIRED_ONE_PARAM;
10808             break;
10809         default:
10810             break;
10811     }
10812     return &g_attributeItem;
10813 }
10814 
GetFontSize(ArkUI_NodeHandle node)10815 const ArkUI_AttributeItem* GetFontSize(ArkUI_NodeHandle node)
10816 {
10817     auto fullImpl = GetFullImpl();
10818     auto unit = GetDefaultUnit(node, UNIT_FP);
10819     switch (node->type) {
10820         case ARKUI_NODE_TEXT:
10821             g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextModifier()->
10822                 getFontSize(node->uiNodeHandle, unit);
10823             g_attributeItem.size = REQUIRED_ONE_PARAM;
10824             break;
10825         case ARKUI_NODE_SPAN:
10826             g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getSpanModifier()->
10827                 getSpanFontSize(node->uiNodeHandle, unit);
10828             g_attributeItem.size = REQUIRED_ONE_PARAM;
10829             break;
10830         case ARKUI_NODE_TEXT_INPUT:
10831         case ARKUI_NODE_TEXT_AREA:
10832             g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
10833                 getTextInputFontSize(node->uiNodeHandle, unit);
10834             g_attributeItem.size = REQUIRED_ONE_PARAM;
10835             break;
10836         case ARKUI_NODE_BUTTON:
10837             g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getButtonModifier()->
10838                 getButtonFontSize(node->uiNodeHandle, unit);
10839             g_attributeItem.size = REQUIRED_ONE_PARAM;
10840             break;
10841         default:
10842             break;
10843     }
10844     return &g_attributeItem;
10845 }
10846 
GetFontStyle(ArkUI_NodeHandle node)10847 const ArkUI_AttributeItem* GetFontStyle(ArkUI_NodeHandle node)
10848 {
10849     auto fullImpl = GetFullImpl();
10850     switch (node->type) {
10851         case ARKUI_NODE_TEXT:
10852             g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->
10853                 getItalicFontStyle(node->uiNodeHandle);
10854             g_attributeItem.size = REQUIRED_ONE_PARAM;
10855             break;
10856         case ARKUI_NODE_SPAN:
10857             g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getSpanModifier()->
10858                 getSpanFontStyle(node->uiNodeHandle);
10859             g_attributeItem.size = REQUIRED_ONE_PARAM;
10860             break;
10861         case ARKUI_NODE_TEXT_INPUT:
10862         case ARKUI_NODE_TEXT_AREA:
10863             g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
10864                 getTextInputFontStyle(node->uiNodeHandle);
10865             g_attributeItem.size = REQUIRED_ONE_PARAM;
10866             break;
10867         default:
10868             break;
10869     }
10870     return &g_attributeItem;
10871 }
10872 
GetFontWeight(ArkUI_NodeHandle node)10873 const ArkUI_AttributeItem* GetFontWeight(ArkUI_NodeHandle node)
10874 {
10875     auto fullImpl = GetFullImpl();
10876     switch (node->type) {
10877         case ARKUI_NODE_TEXT:
10878             g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getFontWeight(node->uiNodeHandle);
10879             g_attributeItem.size = REQUIRED_ONE_PARAM;
10880             break;
10881         case ARKUI_NODE_SPAN:
10882             g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getSpanModifier()->
10883                 getSpanFontWeight(node->uiNodeHandle);
10884             g_attributeItem.size = REQUIRED_ONE_PARAM;
10885             break;
10886         case ARKUI_NODE_TEXT_INPUT:
10887         case ARKUI_NODE_TEXT_AREA:
10888             g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
10889                 getTextInputFontWeight(node->uiNodeHandle);
10890             g_attributeItem.size = REQUIRED_ONE_PARAM;
10891             break;
10892         case ARKUI_NODE_BUTTON:
10893             g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getButtonModifier()->
10894                 getButtonFontWeight(node->uiNodeHandle);
10895             g_attributeItem.size = REQUIRED_ONE_PARAM;
10896             break;
10897         default:
10898             break;
10899     }
10900     return &g_attributeItem;
10901 }
10902 
GetLineHeight(ArkUI_NodeHandle node)10903 const ArkUI_AttributeItem* GetLineHeight(ArkUI_NodeHandle node)
10904 {
10905     auto fullImpl = GetFullImpl();
10906     switch (node->type) {
10907         case ARKUI_NODE_TEXT:
10908             g_numberValues[NUM_0].f32 =
10909                 fullImpl->getNodeModifiers()->getTextModifier()->getTextLineHeight(node->uiNodeHandle);
10910             g_attributeItem.size = REQUIRED_ONE_PARAM;
10911             break;
10912         case ARKUI_NODE_SPAN:
10913             g_numberValues[NUM_0].f32 =
10914                 fullImpl->getNodeModifiers()->getSpanModifier()->getSpanLineHeight(node->uiNodeHandle);
10915             g_attributeItem.size = REQUIRED_ONE_PARAM;
10916             break;
10917         case ARKUI_NODE_TEXT_INPUT:
10918             g_numberValues[NUM_0].f32 =
10919                 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputLineHeight(node->uiNodeHandle);
10920             g_attributeItem.size = REQUIRED_ONE_PARAM;
10921             break;
10922         case ARKUI_NODE_TEXT_AREA:
10923             g_numberValues[NUM_0].f32 =
10924                 fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaLineHeight(node->uiNodeHandle);
10925             g_attributeItem.size = REQUIRED_ONE_PARAM;
10926             break;
10927         default:
10928             break;
10929     }
10930     return &g_attributeItem;
10931 }
10932 
GetDecoration(ArkUI_NodeHandle node)10933 const ArkUI_AttributeItem* GetDecoration(ArkUI_NodeHandle node)
10934 {
10935     auto fullImpl = GetFullImpl();
10936     switch (node->type) {
10937         case ARKUI_NODE_SPAN: {
10938             ArkUITextDecorationType spanDecorationType = { 0, Color::BLACK.GetValue()};
10939             fullImpl->getNodeModifiers()->getSpanModifier()->getSpanDecoration(node->uiNodeHandle, &spanDecorationType);
10940             g_numberValues[0].i32 = spanDecorationType.decorationType;
10941             g_numberValues[DECORATION_COLOR_INDEX].u32 = spanDecorationType.color;
10942             g_numberValues[DECORATION_STYLE_INDEX].i32 = spanDecorationType.style;
10943             g_attributeItem.size = NUM_3;
10944             break;
10945         }
10946         case ARKUI_NODE_TEXT: {
10947             ArkUITextDecorationType textDecorationType = { 0, Color::BLACK.GetValue()};
10948             fullImpl->getNodeModifiers()->getTextModifier()->getTextDecoration(node->uiNodeHandle, &textDecorationType);
10949             g_numberValues[0].i32 = textDecorationType.decorationType;
10950             g_numberValues[DECORATION_COLOR_INDEX].u32 = textDecorationType.color;
10951             g_numberValues[DECORATION_STYLE_INDEX].i32 = textDecorationType.style;
10952             g_attributeItem.size = NUM_3;
10953             break;
10954         }
10955         default:
10956             break;
10957     }
10958 
10959     return &g_attributeItem;
10960 }
10961 
GetTextCase(ArkUI_NodeHandle node)10962 const ArkUI_AttributeItem* GetTextCase(ArkUI_NodeHandle node)
10963 {
10964     auto fullImpl = GetFullImpl();
10965     switch (node->type) {
10966         case ARKUI_NODE_SPAN:
10967             g_numberValues[NUM_0].i32 =
10968                 fullImpl->getNodeModifiers()->getSpanModifier()->getSpanTextCase(node->uiNodeHandle);
10969             g_attributeItem.size = REQUIRED_ONE_PARAM;
10970             break;
10971         case ARKUI_NODE_TEXT:
10972             g_numberValues[NUM_0].i32 =
10973                 fullImpl->getNodeModifiers()->getTextModifier()->getTextTextCase(node->uiNodeHandle);
10974             g_attributeItem.size = REQUIRED_ONE_PARAM;
10975             break;
10976         default:
10977             break;
10978     }
10979     return &g_attributeItem;
10980 }
10981 
GetLetterSpacing(ArkUI_NodeHandle node)10982 const ArkUI_AttributeItem* GetLetterSpacing(ArkUI_NodeHandle node)
10983 {
10984     auto fullImpl = GetFullImpl();
10985     switch (node->type) {
10986         case ARKUI_NODE_SPAN:
10987             g_numberValues[NUM_0].f32 =
10988                 fullImpl->getNodeModifiers()->getSpanModifier()->getSpanLetterSpacing(node->uiNodeHandle);
10989             g_attributeItem.size = REQUIRED_ONE_PARAM;
10990             break;
10991         case ARKUI_NODE_TEXT:
10992             g_numberValues[NUM_0].f32 =
10993                 fullImpl->getNodeModifiers()->getTextModifier()->getTextLetterSpacing(node->uiNodeHandle);
10994             g_attributeItem.size = REQUIRED_ONE_PARAM;
10995             break;
10996         default:
10997             break;
10998     }
10999     return &g_attributeItem;
11000 }
11001 
GetMaxLines(ArkUI_NodeHandle node)11002 const ArkUI_AttributeItem* GetMaxLines(ArkUI_NodeHandle node)
11003 {
11004     auto fullImpl = GetFullImpl();
11005     switch (node->type) {
11006         case ARKUI_NODE_TEXT:
11007             g_numberValues[NUM_0].i32 =
11008                 fullImpl->getNodeModifiers()->getTextModifier()->getTextMaxLines(node->uiNodeHandle);
11009             g_attributeItem.size = REQUIRED_ONE_PARAM;
11010             break;
11011         case ARKUI_NODE_TEXT_INPUT:
11012             g_numberValues[NUM_0].i32 =
11013                 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputMaxLines(node->uiNodeHandle);
11014             g_attributeItem.size = REQUIRED_ONE_PARAM;
11015             break;
11016         case ARKUI_NODE_TEXT_AREA:
11017             g_numberValues[NUM_0].i32 =
11018                 fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaMaxLines(node->uiNodeHandle);
11019             g_attributeItem.size = REQUIRED_ONE_PARAM;
11020             break;
11021         default:
11022             break;
11023     }
11024     return &g_attributeItem;
11025 }
11026 
GetTextAlign(ArkUI_NodeHandle node)11027 const ArkUI_AttributeItem* GetTextAlign(ArkUI_NodeHandle node)
11028 {
11029     auto fullImpl = GetFullImpl();
11030     int32_t textAlign = NUM_0;
11031     if (node->type == ARKUI_NODE_TEXT) {
11032         textAlign = fullImpl->getNodeModifiers()->getTextModifier()->getTextAlign(node->uiNodeHandle);
11033     } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
11034         textAlign = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputTextAlign(node->uiNodeHandle);
11035     } else if (node->type == ARKUI_NODE_TEXT_AREA) {
11036         textAlign = fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaTextAlign(node->uiNodeHandle);
11037     }
11038     g_numberValues[0].i32 = textAlign;
11039     g_attributeItem.size = REQUIRED_ONE_PARAM;
11040     return &g_attributeItem;
11041 }
11042 
GetTextOverflow(ArkUI_NodeHandle node)11043 const ArkUI_AttributeItem* GetTextOverflow(ArkUI_NodeHandle node)
11044 {
11045     auto fullImpl = GetFullImpl();
11046     g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextTextOverflow(node->uiNodeHandle);
11047     g_attributeItem.size = REQUIRED_ONE_PARAM;
11048     return &g_attributeItem;
11049 }
11050 
GetTextIndent(ArkUI_NodeHandle node)11051 const ArkUI_AttributeItem* GetTextIndent(ArkUI_NodeHandle node)
11052 {
11053     auto fullImpl = GetFullImpl();
11054     g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextTextIndent(node->uiNodeHandle);
11055     g_attributeItem.size = REQUIRED_ONE_PARAM;
11056     return &g_attributeItem;
11057 }
11058 
GetSpanContent(ArkUI_NodeHandle node)11059 const ArkUI_AttributeItem* GetSpanContent(ArkUI_NodeHandle node)
11060 {
11061     auto fullImpl = GetFullImpl();
11062     auto content = fullImpl->getNodeModifiers()->getSpanModifier()->getSpanContent(node->uiNodeHandle);
11063     g_attributeItem.string = (content != nullptr ? content : EMPTY_STR.c_str());
11064     return &g_attributeItem;
11065 }
11066 
GetSpanTextBackgroundStyle(ArkUI_NodeHandle node)11067 const ArkUI_AttributeItem* GetSpanTextBackgroundStyle(ArkUI_NodeHandle node)
11068 {
11069     auto fullImpl = GetFullImpl();
11070     ArkUITextBackgroundStyleOptions options;
11071     fullImpl->getNodeModifiers()->getSpanModifier()->getSpanTextBackgroundStyle(node->uiNodeHandle, &options);
11072     g_numberValues[NUM_0].u32 = options.color;
11073     g_numberValues[NUM_1].f32 = options.topLeft;
11074     g_numberValues[NUM_2].f32 = options.topRight;
11075     g_numberValues[NUM_3].f32 = options.bottomLeft;
11076     g_numberValues[NUM_4].f32 = options.bottomRight;
11077     return &g_attributeItem;
11078 }
11079 
GetImageSpanSrc(ArkUI_NodeHandle node)11080 const ArkUI_AttributeItem* GetImageSpanSrc(ArkUI_NodeHandle node)
11081 {
11082     auto fullImpl = GetFullImpl();
11083     auto src = fullImpl->getNodeModifiers()->getImageModifier()->getImageSrc(node->uiNodeHandle);
11084     g_attributeItem.string = (src != nullptr ? src : EMPTY_STR.c_str());
11085     if (node->drawableDescriptor) {
11086         g_attributeItem.object = node->drawableDescriptor;
11087     }
11088     return &g_attributeItem;
11089 }
11090 
GetVerticalAlign(ArkUI_NodeHandle node)11091 const ArkUI_AttributeItem* GetVerticalAlign(ArkUI_NodeHandle node)
11092 {
11093     auto fullImpl = GetFullImpl();
11094     auto verticalAlign =
11095         fullImpl->getNodeModifiers()->getImageSpanModifier()->getImageSpanVerticalAlign(node->uiNodeHandle);
11096     auto it = std::find(IMAGE_SPAN_ALIGNMENT_ARRAY.begin(), IMAGE_SPAN_ALIGNMENT_ARRAY.end(), verticalAlign);
11097     if (it != IMAGE_SPAN_ALIGNMENT_ARRAY.end()) {
11098         g_numberValues[0].i32 = std::distance(IMAGE_SPAN_ALIGNMENT_ARRAY.begin(), it);
11099         g_attributeItem.size = REQUIRED_ONE_PARAM;
11100     }
11101     return &g_attributeItem;
11102 }
11103 
GetImageSrc(ArkUI_NodeHandle node)11104 const ArkUI_AttributeItem* GetImageSrc(ArkUI_NodeHandle node)
11105 {
11106     auto fullImpl = GetFullImpl();
11107     auto src = fullImpl->getNodeModifiers()->getImageModifier()->getImageSrc(node->uiNodeHandle);
11108     g_attributeItem.string = (src != nullptr ? src : EMPTY_STR.c_str());
11109     if (node->drawableDescriptor) {
11110         g_attributeItem.object = node->drawableDescriptor;
11111     }
11112     return &g_attributeItem;
11113 }
11114 
GetObjectFit(ArkUI_NodeHandle node)11115 const ArkUI_AttributeItem* GetObjectFit(ArkUI_NodeHandle node)
11116 {
11117     auto fullImpl = GetFullImpl();
11118     auto resultValue = fullImpl->getNodeModifiers()->getImageModifier()->getObjectFit(node->uiNodeHandle);
11119     auto it = std::find(OBJECT_FIT_ARRAY.begin(), OBJECT_FIT_ARRAY.end(), resultValue);
11120     if (it != OBJECT_FIT_ARRAY.end()) {
11121         g_numberValues[0].i32 = std::distance(OBJECT_FIT_ARRAY.begin(), it);
11122     } else {
11123         g_numberValues[0].i32 = static_cast<int32_t>(ARKUI_OBJECT_FIT_COVER);
11124     }
11125     g_attributeItem.size = REQUIRED_ONE_PARAM;
11126     return &g_attributeItem;
11127 }
11128 
GetInterpolation(ArkUI_NodeHandle node)11129 const ArkUI_AttributeItem* GetInterpolation(ArkUI_NodeHandle node)
11130 {
11131     auto fullImpl = GetFullImpl();
11132     auto interpolation = fullImpl->getNodeModifiers()->getImageModifier()->getImageInterpolation(node->uiNodeHandle);
11133     g_numberValues[0].i32 = interpolation;
11134     g_attributeItem.size = REQUIRED_ONE_PARAM;
11135     return &g_attributeItem;
11136 }
11137 
GetObjectRepeat(ArkUI_NodeHandle node)11138 const ArkUI_AttributeItem* GetObjectRepeat(ArkUI_NodeHandle node)
11139 {
11140     auto fullImpl = GetFullImpl();
11141     auto objectRepeat = fullImpl->getNodeModifiers()->getImageModifier()->getObjectRepeat(node->uiNodeHandle);
11142     g_numberValues[0].i32 = objectRepeat;
11143     g_attributeItem.size = REQUIRED_ONE_PARAM;
11144     return &g_attributeItem;
11145 }
11146 
GetColorFilter(ArkUI_NodeHandle node)11147 const ArkUI_AttributeItem* GetColorFilter(ArkUI_NodeHandle node)
11148 {
11149     auto fullImpl = GetFullImpl();
11150     auto colorFilter = fullImpl->getNodeModifiers()->getImageModifier()->getDrawingColorFilter(node->uiNodeHandle);
11151     if (colorFilter) {
11152         g_attributeItem.object = colorFilter;
11153         g_attributeItem.size = 0;
11154         return &g_attributeItem;
11155     }
11156     g_attributeItem.size = REQUIRED_TWENTY_PARAM;
11157     for (size_t i = 0; i < REQUIRED_TWENTY_PARAM; i++) {
11158         g_numberValues[i].f32 = 0;
11159     }
11160     ArkUIFilterColorType colorFilterType = { .filterArray = &g_numberValues[0].f32,
11161         .filterSize = REQUIRED_TWENTY_PARAM };
11162     fullImpl->getNodeModifiers()->getImageModifier()->getColorFilter(node->uiNodeHandle, &colorFilterType);
11163     return &g_attributeItem;
11164 }
11165 
GetAutoResize(ArkUI_NodeHandle node)11166 const ArkUI_AttributeItem* GetAutoResize(ArkUI_NodeHandle node)
11167 {
11168     auto fullImpl = GetFullImpl();
11169     auto autoResize = fullImpl->getNodeModifiers()->getImageModifier()->getAutoResize(node->uiNodeHandle);
11170     g_numberValues[0].i32 = autoResize;
11171     g_attributeItem.size = REQUIRED_ONE_PARAM;
11172     return &g_attributeItem;
11173 }
11174 
GetAlt(ArkUI_NodeHandle node)11175 const ArkUI_AttributeItem* GetAlt(ArkUI_NodeHandle node)
11176 {
11177     auto fullImpl = GetFullImpl();
11178     auto src = fullImpl->getNodeModifiers()->getImageModifier()->getAlt(node->uiNodeHandle);
11179     g_attributeItem.string = (src != nullptr ? src : EMPTY_STR.c_str());
11180     if (node->altDrawableDescriptor) {
11181         g_attributeItem.object = node->altDrawableDescriptor;
11182     }
11183     return &g_attributeItem;
11184 }
11185 
GetImageDraggable(ArkUI_NodeHandle node)11186 const ArkUI_AttributeItem* GetImageDraggable(ArkUI_NodeHandle node)
11187 {
11188     auto fullImpl = GetFullImpl();
11189     auto draggable = fullImpl->getNodeModifiers()->getImageModifier()->getImageDraggable(node->uiNodeHandle);
11190     g_numberValues[0].i32 = draggable;
11191     g_attributeItem.size = REQUIRED_ONE_PARAM;
11192     return &g_attributeItem;
11193 }
11194 
SetCheckboxSelect(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11195 int32_t SetCheckboxSelect(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11196 {
11197     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11198         return ERROR_CODE_PARAM_INVALID;
11199     }
11200     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setSelect(node->uiNodeHandle, item->value[0].i32);
11201     return ERROR_CODE_NO_ERROR;
11202 }
11203 
GetCheckboxSelect(ArkUI_NodeHandle node)11204 const ArkUI_AttributeItem* GetCheckboxSelect(ArkUI_NodeHandle node)
11205 {
11206     auto resultValue = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getSelect(node->uiNodeHandle);
11207     g_numberValues[0].i32 = resultValue;
11208     return &g_attributeItem;
11209 }
11210 
ResetCheckboxSelect(ArkUI_NodeHandle node)11211 void ResetCheckboxSelect(ArkUI_NodeHandle node)
11212 {
11213     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetSelect(node->uiNodeHandle);
11214 }
11215 
SetCheckboxSelectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11216 int32_t SetCheckboxSelectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11217 {
11218     if (item->size == 0) {
11219         return ERROR_CODE_PARAM_INVALID;
11220     }
11221     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setSelectedColor(node->uiNodeHandle, item->value[0].u32);
11222     return ERROR_CODE_NO_ERROR;
11223 }
11224 
GetCheckboxSelectedColor(ArkUI_NodeHandle node)11225 const ArkUI_AttributeItem* GetCheckboxSelectedColor(ArkUI_NodeHandle node)
11226 {
11227     auto resultValue = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getSelectedColor(node->uiNodeHandle);
11228     g_numberValues[0].u32 = resultValue;
11229     return &g_attributeItem;
11230 }
11231 
ResetCheckboxSelectedColor(ArkUI_NodeHandle node)11232 void ResetCheckboxSelectedColor(ArkUI_NodeHandle node)
11233 {
11234     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetSelectedColor(node->uiNodeHandle);
11235 }
11236 
SetCheckboxUnSelectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11237 int32_t SetCheckboxUnSelectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11238 {
11239     if (item->size == 0) {
11240         return ERROR_CODE_PARAM_INVALID;
11241     }
11242     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setUnSelectedColor(
11243         node->uiNodeHandle, item->value[0].u32);
11244     return ERROR_CODE_NO_ERROR;
11245 }
11246 
GetCheckboxUnSelectedColor(ArkUI_NodeHandle node)11247 const ArkUI_AttributeItem* GetCheckboxUnSelectedColor(ArkUI_NodeHandle node)
11248 {
11249     auto resultValue = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getUnSelectedColor(node->uiNodeHandle);
11250     g_numberValues[0].u32 = resultValue;
11251     return &g_attributeItem;
11252 }
11253 
ResetCheckboxUnSelectedColor(ArkUI_NodeHandle node)11254 void ResetCheckboxUnSelectedColor(ArkUI_NodeHandle node)
11255 {
11256     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetUnSelectedColor(node->uiNodeHandle);
11257 }
11258 
SetCheckboxMark(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11259 int32_t SetCheckboxMark(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11260 {
11261     if (item->size == 0) {
11262         return ERROR_CODE_PARAM_INVALID;
11263     }
11264     // defalut white
11265     int strokeColor = item->value[0].u32;
11266     double size = -1;
11267     if (item->size > 1) {
11268         //check 2 for size
11269         if (LessNotEqual(item->value[1].f32, 0.0f)) {
11270             return ERROR_CODE_PARAM_INVALID;
11271         }
11272         //set 2 for size
11273         size = item->value[1].f32;
11274     }
11275     // defalut 2
11276     double strokeWidth = 2;
11277     if (item->size > ALLOW_SIZE_2) {
11278         //check 2 for strokeWidth
11279         if (LessNotEqual(item->value[2].f32, 0.0f)) {
11280             return ERROR_CODE_PARAM_INVALID;
11281         }
11282         //set 2 for strokeWidth
11283         strokeWidth = item->value[2].f32;
11284     }
11285     int32_t unit = GetDefaultUnit(node, UNIT_VP);
11286     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setMark(
11287         node->uiNodeHandle, strokeColor, size, unit, strokeWidth, unit);
11288     return ERROR_CODE_NO_ERROR;
11289 }
11290 
GetCheckboxMark(ArkUI_NodeHandle node)11291 const ArkUI_AttributeItem* GetCheckboxMark(ArkUI_NodeHandle node)
11292 {
11293     auto strokeColor = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getCheckMarkColor(node->uiNodeHandle);
11294     auto size = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getCheckMarkSize(node->uiNodeHandle);
11295     auto strokeWidth = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getCheckMarkWidth(node->uiNodeHandle);
11296     int index = 0;
11297     g_numberValues[index++].u32 = strokeColor;
11298     g_numberValues[index++].f32 = size;
11299     g_numberValues[index++].f32 = strokeWidth;
11300     g_attributeItem.size = index;
11301     return &g_attributeItem;
11302 }
11303 
ResetCheckboxMark(ArkUI_NodeHandle node)11304 void ResetCheckboxMark(ArkUI_NodeHandle node)
11305 {
11306     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetMark(node->uiNodeHandle);
11307 }
11308 
SetCheckboxShape(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11309 int32_t SetCheckboxShape(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11310 {
11311     if (item->size == 0 || !CheckAttributeIsCheckboxShape(item->value[0].i32)) {
11312         return ERROR_CODE_PARAM_INVALID;
11313     }
11314     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setCheckboxShape(node->uiNodeHandle, item->value[0].i32);
11315     return ERROR_CODE_NO_ERROR;
11316 }
11317 
GetCheckboxShape(ArkUI_NodeHandle node)11318 const ArkUI_AttributeItem* GetCheckboxShape(ArkUI_NodeHandle node)
11319 {
11320     auto resultValue = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getCheckboxShape(node->uiNodeHandle);
11321     g_numberValues[0].i32 = resultValue;
11322     return &g_attributeItem;
11323 }
11324 
ResetCheckboxShape(ArkUI_NodeHandle node)11325 void ResetCheckboxShape(ArkUI_NodeHandle node)
11326 {
11327     GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetCheckboxShape(node->uiNodeHandle);
11328 }
11329 
SetSliderBlockColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11330 int32_t SetSliderBlockColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11331 {
11332     if (item->size == 0) {
11333         return ERROR_CODE_PARAM_INVALID;
11334     }
11335 
11336     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setBlockColor(node->uiNodeHandle, item->value[0].u32);
11337     return ERROR_CODE_NO_ERROR;
11338 }
11339 
GetSliderBlockColor(ArkUI_NodeHandle node)11340 const ArkUI_AttributeItem* GetSliderBlockColor(ArkUI_NodeHandle node)
11341 {
11342     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getBlockColor(node->uiNodeHandle);
11343     g_numberValues[0].u32 = resultValue;
11344     return &g_attributeItem;
11345 }
11346 
ResetSliderBlockColor(ArkUI_NodeHandle node)11347 void ResetSliderBlockColor(ArkUI_NodeHandle node)
11348 {
11349     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetBlockColor(node->uiNodeHandle);
11350 }
11351 
SetSliderTrackColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11352 int32_t SetSliderTrackColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11353 {
11354     if (item->size == 0) {
11355         return ERROR_CODE_PARAM_INVALID;
11356     }
11357     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setTrackBackgroundColor(
11358         node->uiNodeHandle, item->value[0].u32);
11359     return ERROR_CODE_NO_ERROR;
11360 }
11361 
GetSliderTrackColor(ArkUI_NodeHandle node)11362 const ArkUI_AttributeItem* GetSliderTrackColor(ArkUI_NodeHandle node)
11363 {
11364     auto resultValue =
11365         GetFullImpl()->getNodeModifiers()->getSliderModifier()->getTrackBackgroundColor(node->uiNodeHandle);
11366     g_numberValues[0].u32 = resultValue;
11367     return &g_attributeItem;
11368 }
11369 
ResetSliderTrackColor(ArkUI_NodeHandle node)11370 void ResetSliderTrackColor(ArkUI_NodeHandle node)
11371 {
11372     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetTrackBackgroundColor(node->uiNodeHandle);
11373 }
11374 
SetSliderSelectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11375 int32_t SetSliderSelectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11376 {
11377     if (item->size == 0) {
11378         return ERROR_CODE_PARAM_INVALID;
11379     }
11380     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSelectColor(node->uiNodeHandle, item->value[0].u32);
11381     return ERROR_CODE_NO_ERROR;
11382 }
11383 
GetSliderSelectedColor(ArkUI_NodeHandle node)11384 const ArkUI_AttributeItem* GetSliderSelectedColor(ArkUI_NodeHandle node)
11385 {
11386     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getSelectColor(node->uiNodeHandle);
11387     g_numberValues[0].u32 = resultValue;
11388     return &g_attributeItem;
11389 }
11390 
ResetSliderSelectedColor(ArkUI_NodeHandle node)11391 void ResetSliderSelectedColor(ArkUI_NodeHandle node)
11392 {
11393     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSelectColor(node->uiNodeHandle);
11394 }
11395 
SetSliderShowSteps(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11396 int32_t SetSliderShowSteps(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11397 {
11398     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11399         return ERROR_CODE_PARAM_INVALID;
11400     }
11401     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setShowSteps(node->uiNodeHandle, item->value[0].i32);
11402     return ERROR_CODE_NO_ERROR;
11403 }
11404 
GetSliderShowSteps(ArkUI_NodeHandle node)11405 const ArkUI_AttributeItem* GetSliderShowSteps(ArkUI_NodeHandle node)
11406 {
11407     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getShowSteps(node->uiNodeHandle);
11408     g_numberValues[0].i32 = resultValue;
11409     return &g_attributeItem;
11410 }
11411 
ResetSliderShowSteps(ArkUI_NodeHandle node)11412 void ResetSliderShowSteps(ArkUI_NodeHandle node)
11413 {
11414     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetShowSteps(node->uiNodeHandle);
11415 }
11416 
SetSliderBlockStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11417 int32_t SetSliderBlockStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11418 {
11419     if (item->size == 0 || !CheckAttributeIsSliderBlockStyle(item->value[0].i32)) {
11420         return ERROR_CODE_PARAM_INVALID;
11421     }
11422     int style = item->value[0].i32;
11423 
11424     if (style == NUM_1) {
11425         if (item->string == nullptr) {
11426             return ERROR_CODE_PARAM_INVALID;
11427         }
11428         // image
11429         std::string src(item->string);
11430         std::string bundle;
11431         std::string module;
11432         GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSliderBlockImage(
11433             node->uiNodeHandle, src.c_str(), bundle.c_str(), module.c_str());
11434     } else if (style == NUM_2) {
11435         auto* fullImpl = GetFullImpl();
11436         if (item->value[1].i32 == ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH) {
11437             ArkUI_Float32 pathAttributes[NUM_2];
11438             if (LessNotEqual(item->value[NUM_2].f32, 0.0f) || LessNotEqual(item->value[NUM_3].f32, 0.0f)) {
11439                 return ERROR_CODE_PARAM_INVALID;
11440             } else {
11441                 pathAttributes[NUM_0] = item->value[NUM_2].f32;
11442                 pathAttributes[NUM_1] = item->value[NUM_3].f32;
11443             }
11444 
11445             fullImpl->getNodeModifiers()->getSliderModifier()->setSliderBlockPath(
11446                 node->uiNodeHandle, "path", &pathAttributes, item->string);
11447         } else {
11448             ArkUI_Float32 attributes[item->size - NUM_2];
11449             for (int i = NUM_2; i < item->size; i++) {
11450                 if (LessNotEqual(item->value[i].f32, 0.0f)) {
11451                     return ERROR_CODE_PARAM_INVALID;
11452                 } else {
11453                     attributes[i - NUM_2] = item->value[i].f32;
11454                 }
11455             }
11456             fullImpl->getNodeModifiers()->getSliderModifier()->setSliderBlockShape(
11457                 node->uiNodeHandle, ShapeToString(item->value[1].i32).c_str(), attributes, item->size - NUM_2);
11458         }
11459     }
11460     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSliderBlockType(node->uiNodeHandle, style);
11461     return ERROR_CODE_NO_ERROR;
11462 }
11463 
GetSliderBlockStyle(ArkUI_NodeHandle node)11464 const ArkUI_AttributeItem* GetSliderBlockStyle(ArkUI_NodeHandle node)
11465 {
11466     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getBlockType(node->uiNodeHandle);
11467     //index 0 style
11468     g_numberValues[0].i32 = resultValue;
11469     switch (resultValue) {
11470         case NUM_1: {
11471             auto imageValue =
11472                 GetFullImpl()->getNodeModifiers()->getSliderModifier()->getBlockImageValue(node->uiNodeHandle);
11473             g_attributeItem.string = imageValue;
11474             break;
11475         }
11476         case NUM_2: {
11477             ArkUI_Float32 values[NUM_5];
11478             auto pathCommands = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getSliderBlockShape(
11479                 node->uiNodeHandle, &values);
11480             //index 1 shapeType
11481             g_numberValues[1].i32 = values[0];
11482             //index 2 width
11483             g_numberValues[2].f32 = values[1];
11484             //index 3 height
11485             g_numberValues[3].f32 = values[2];
11486             g_attributeItem.size = NUM_3;
11487             ArkUI_ShapeType shapeType = static_cast<ArkUI_ShapeType>(values[0]);
11488             if (shapeType == ArkUI_ShapeType::ARKUI_SHAPE_TYPE_RECTANGLE) {
11489                 //index 4 width
11490                 g_numberValues[4].f32 = values[3];
11491                 //index 5 height
11492                 g_numberValues[5].f32 = values[4];
11493                 g_attributeItem.size = NUM_6;
11494             } else if (shapeType == ArkUI_ShapeType::ARKUI_SHAPE_TYPE_PATH) {
11495                 g_attributeItem.string = pathCommands;
11496             }
11497             break;
11498         }
11499         default:
11500             break;
11501     }
11502 
11503     return &g_attributeItem;
11504 }
11505 
ResetSliderBlockStyle(ArkUI_NodeHandle node)11506 void ResetSliderBlockStyle(ArkUI_NodeHandle node)
11507 {
11508     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderBlockImage(node->uiNodeHandle);
11509     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderBlockShape(node->uiNodeHandle);
11510     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderBlockType(node->uiNodeHandle);
11511 }
11512 
SetSliderValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11513 int32_t SetSliderValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11514 {
11515     if (item->size == 0) {
11516         return ERROR_CODE_PARAM_INVALID;
11517     }
11518     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSliderValue(node->uiNodeHandle, item->value[0].f32);
11519     return ERROR_CODE_NO_ERROR;
11520 }
11521 
GetSliderValue(ArkUI_NodeHandle node)11522 const ArkUI_AttributeItem* GetSliderValue(ArkUI_NodeHandle node)
11523 {
11524     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getSliderValue(node->uiNodeHandle);
11525     g_numberValues[0].f32 = resultValue;
11526     return &g_attributeItem;
11527 }
11528 
ResetSliderValue(ArkUI_NodeHandle node)11529 void ResetSliderValue(ArkUI_NodeHandle node)
11530 {
11531     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderValue(node->uiNodeHandle);
11532 }
11533 
SetSliderMinValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11534 int32_t SetSliderMinValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11535 {
11536     if (item->size == 0) {
11537         return ERROR_CODE_PARAM_INVALID;
11538     }
11539     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setMinLabel(node->uiNodeHandle, item->value[0].f32);
11540     return ERROR_CODE_NO_ERROR;
11541 }
11542 
GetSliderMinValue(ArkUI_NodeHandle node)11543 const ArkUI_AttributeItem* GetSliderMinValue(ArkUI_NodeHandle node)
11544 {
11545     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getMinLabel(node->uiNodeHandle);
11546     g_numberValues[0].f32 = resultValue;
11547     return &g_attributeItem;
11548 }
11549 
ResetSliderMinValue(ArkUI_NodeHandle node)11550 void ResetSliderMinValue(ArkUI_NodeHandle node)
11551 {
11552     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetMinLabel(node->uiNodeHandle);
11553 }
11554 
SetSliderMaxValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11555 int32_t SetSliderMaxValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11556 {
11557     if (item->size == 0) {
11558         return ERROR_CODE_PARAM_INVALID;
11559     }
11560     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setMaxLabel(node->uiNodeHandle, item->value[0].f32);
11561     return ERROR_CODE_NO_ERROR;
11562 }
11563 
GetSliderMaxValue(ArkUI_NodeHandle node)11564 const ArkUI_AttributeItem* GetSliderMaxValue(ArkUI_NodeHandle node)
11565 {
11566     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getMaxLabel(node->uiNodeHandle);
11567     g_numberValues[0].f32 = resultValue;
11568     return &g_attributeItem;
11569 }
11570 
ResetSliderMaxValue(ArkUI_NodeHandle node)11571 void ResetSliderMaxValue(ArkUI_NodeHandle node)
11572 {
11573     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetMaxLabel(node->uiNodeHandle);
11574 }
11575 
SetSliderStep(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11576 int32_t SetSliderStep(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11577 {
11578     if (item->size == 0 || LessNotEqual(item->value[0].f32, SLIDER_STEP_MIN_F)) {
11579         return ERROR_CODE_PARAM_INVALID;
11580     }
11581     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setStep(node->uiNodeHandle, item->value[0].f32);
11582     return ERROR_CODE_NO_ERROR;
11583 }
11584 
GetSliderStep(ArkUI_NodeHandle node)11585 const ArkUI_AttributeItem* GetSliderStep(ArkUI_NodeHandle node)
11586 {
11587     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getStep(node->uiNodeHandle);
11588     g_numberValues[0].f32 = resultValue;
11589     return &g_attributeItem;
11590 }
11591 
ResetSliderStep(ArkUI_NodeHandle node)11592 void ResetSliderStep(ArkUI_NodeHandle node)
11593 {
11594     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetStep(node->uiNodeHandle);
11595 }
11596 
SetSliderDirection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11597 int32_t SetSliderDirection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11598 {
11599     if (item->size == 0 || !CheckAttributeIsSliderDirection(item->value[0].i32)) {
11600         return ERROR_CODE_PARAM_INVALID;
11601     }
11602     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setDirection(node->uiNodeHandle, item->value[0].i32);
11603     return ERROR_CODE_NO_ERROR;
11604 }
11605 
GetSliderDirection(ArkUI_NodeHandle node)11606 const ArkUI_AttributeItem* GetSliderDirection(ArkUI_NodeHandle node)
11607 {
11608     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getDirection(node->uiNodeHandle);
11609     g_numberValues[0].i32 = resultValue;
11610     return &g_attributeItem;
11611 }
11612 
ResetSliderDirection(ArkUI_NodeHandle node)11613 void ResetSliderDirection(ArkUI_NodeHandle node)
11614 {
11615     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetDirection(node->uiNodeHandle);
11616 }
11617 
SetSliderReverse(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11618 int32_t SetSliderReverse(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11619 {
11620     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11621         return ERROR_CODE_PARAM_INVALID;
11622     }
11623     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setReverse(node->uiNodeHandle, item->value[0].i32);
11624     return ERROR_CODE_NO_ERROR;
11625 }
11626 
GetSliderReverse(ArkUI_NodeHandle node)11627 const ArkUI_AttributeItem* GetSliderReverse(ArkUI_NodeHandle node)
11628 {
11629     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getReverse(node->uiNodeHandle);
11630     g_numberValues[0].i32 = resultValue;
11631     return &g_attributeItem;
11632 }
11633 
ResetSliderReverse(ArkUI_NodeHandle node)11634 void ResetSliderReverse(ArkUI_NodeHandle node)
11635 {
11636     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetReverse(node->uiNodeHandle);
11637 }
11638 
SetSliderStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11639 int32_t SetSliderStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11640 {
11641     if (item->size == 0 || !CheckAttributeIsSliderStyle(item->value[0].i32)) {
11642         return ERROR_CODE_PARAM_INVALID;
11643     }
11644     GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSliderStyle(node->uiNodeHandle, item->value[0].i32);
11645     return ERROR_CODE_NO_ERROR;
11646 }
11647 
GetSliderStyle(ArkUI_NodeHandle node)11648 const ArkUI_AttributeItem* GetSliderStyle(ArkUI_NodeHandle node)
11649 {
11650     auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getSliderStyle(node->uiNodeHandle);
11651     g_numberValues[0].i32 = resultValue;
11652     return &g_attributeItem;
11653 }
11654 
ResetSliderStyle(ArkUI_NodeHandle node)11655 void ResetSliderStyle(ArkUI_NodeHandle node)
11656 {
11657     GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderStyle(node->uiNodeHandle);
11658 }
11659 
SetSliderTrackThickness(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11660 int32_t SetSliderTrackThickness(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11661 {
11662     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
11663     if (LessNotEqual(actualSize, 0) || LessOrEqual(item->value[NUM_0].f32, 0.0f)) {
11664         return ERROR_CODE_PARAM_INVALID;
11665     }
11666 
11667     auto* fullImpl = GetFullImpl();
11668     fullImpl->getNodeModifiers()->getSliderModifier()->setThickness(
11669         node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP));
11670     return ERROR_CODE_NO_ERROR;
11671 }
11672 
GetSliderTrackThickness(ArkUI_NodeHandle node)11673 const ArkUI_AttributeItem* GetSliderTrackThickness(ArkUI_NodeHandle node)
11674 {
11675     auto modifier = GetFullImpl()->getNodeModifiers()->getSliderModifier();
11676     g_numberValues[0].f32 = modifier->getThickness(node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
11677     if (LessOrEqual(g_numberValues[0].f32, 0.0f)) {
11678         return nullptr;
11679     }
11680     return &g_attributeItem;
11681 }
11682 
ResetSliderTrackThickness(ArkUI_NodeHandle node)11683 void ResetSliderTrackThickness(ArkUI_NodeHandle node)
11684 {
11685     auto* fullImpl = GetFullImpl();
11686     fullImpl->getNodeModifiers()->getSliderModifier()->resetThickness(node->uiNodeHandle);
11687 }
11688 
SetSliderValidSlideRange(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11689 int32_t SetSliderValidSlideRange(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11690 {
11691     if (!item || std::isnan(item->value[NUM_0].f32) || std::isnan(item->value[NUM_1].f32)) {
11692         return ERROR_CODE_PARAM_INVALID;
11693     }
11694 
11695     auto* fullImpl = GetFullImpl();
11696     fullImpl->getNodeModifiers()->getSliderModifier()->setSliderValidSlideRange(
11697         node->uiNodeHandle, item->value[NUM_0].f32, item->value[NUM_1].f32);
11698     return ERROR_CODE_NO_ERROR;
11699 }
11700 
GetSliderValidSlideRange(ArkUI_NodeHandle node)11701 const ArkUI_AttributeItem* GetSliderValidSlideRange(ArkUI_NodeHandle node)
11702 {
11703     auto modifier = GetFullImpl()->getNodeModifiers()->getSliderModifier();
11704     ArkUISliderValidSlideRange validRange = modifier->getSliderValidSlideRange(node->uiNodeHandle);
11705     if (std::isnan(validRange.from) || std::isnan(validRange.to)) {
11706         return nullptr;
11707     }
11708     g_numberValues[NUM_0].f32 = validRange.from;
11709     g_numberValues[NUM_1].f32 = validRange.to;
11710     return &g_attributeItem;
11711 }
11712 
ResetSliderValidSlideRange(ArkUI_NodeHandle node)11713 void ResetSliderValidSlideRange(ArkUI_NodeHandle node)
11714 {
11715     auto* fullImpl = GetFullImpl();
11716     fullImpl->getNodeModifiers()->getSliderModifier()->resetSliderValidSlideRange(node->uiNodeHandle);
11717 }
11718 
SetRefreshRefreshing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11719 int32_t SetRefreshRefreshing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11720 {
11721     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11722         return ERROR_CODE_PARAM_INVALID;
11723     }
11724     GetFullImpl()->getNodeModifiers()->getRefreshModifier()->setRefreshing(
11725         node->uiNodeHandle, item->value[0].i32);
11726     return ERROR_CODE_NO_ERROR;
11727 }
11728 
GetRefreshRefreshing(ArkUI_NodeHandle node)11729 const ArkUI_AttributeItem* GetRefreshRefreshing(ArkUI_NodeHandle node)
11730 {
11731     auto resultValue = GetFullImpl()->getNodeModifiers()->getRefreshModifier()->getRefreshing(node->uiNodeHandle);
11732     g_numberValues[0].i32 = resultValue;
11733     return &g_attributeItem;
11734 }
11735 
SetRefreshContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11736 int32_t SetRefreshContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11737 {
11738     if (!item->object) {
11739         return ERROR_CODE_PARAM_INVALID;
11740     }
11741     auto fullImpl = GetFullImpl();
11742     auto contentNodeHandle = reinterpret_cast<ArkUI_NodeHandle>(item->object);
11743     fullImpl->getNodeModifiers()->getRefreshModifier()->setRefreshContent(
11744         node->uiNodeHandle, contentNodeHandle->uiNodeHandle);
11745     return ERROR_CODE_NO_ERROR;
11746 }
11747 
ResetRefreshContent(ArkUI_NodeHandle node)11748 void ResetRefreshContent(ArkUI_NodeHandle node)
11749 {
11750     GetFullImpl()->getNodeModifiers()->getRefreshModifier()->setRefreshContent(node->uiNodeHandle, nullptr);
11751 }
11752 
SetRefreshPullDownRatio(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11753 int32_t SetRefreshPullDownRatio(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11754 {
11755     if (item->size == 0) {
11756         return ERROR_CODE_PARAM_INVALID;
11757     }
11758     if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
11759         return ERROR_CODE_PARAM_INVALID;
11760     }
11761     // already check in entry point.
11762     auto* fullImpl = GetFullImpl();
11763     fullImpl->getNodeModifiers()->getRefreshModifier()->setPullDownRatio(node->uiNodeHandle, item->value[0].f32);
11764     return ERROR_CODE_NO_ERROR;
11765 }
11766 
ResetRefreshPullDownRatio(ArkUI_NodeHandle node)11767 void ResetRefreshPullDownRatio(ArkUI_NodeHandle node)
11768 {
11769     auto* fullImpl = GetFullImpl();
11770     fullImpl->getNodeModifiers()->getRefreshModifier()->resetPullDownRatio(node->uiNodeHandle);
11771 }
11772 
GetRefreshPullDownRatio(ArkUI_NodeHandle node)11773 const ArkUI_AttributeItem* GetRefreshPullDownRatio(ArkUI_NodeHandle node)
11774 {
11775     auto resultValue = GetFullImpl()->getNodeModifiers()->getRefreshModifier()->getPullDownRatio(node->uiNodeHandle);
11776     g_numberValues[0].f32 = resultValue;
11777     return &g_attributeItem;
11778 }
11779 
SetRefreshOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11780 int32_t SetRefreshOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11781 {
11782     if (item->size == 0) {
11783         return ERROR_CODE_PARAM_INVALID;
11784     }
11785     if (LessOrEqual(item->value[0].f32, 0.0f)) {
11786         return ERROR_CODE_PARAM_INVALID;
11787     }
11788     // already check in entry point.
11789     auto* fullImpl = GetFullImpl();
11790     int32_t unit = GetDefaultUnit(node, UNIT_VP);
11791     fullImpl->getNodeModifiers()->getRefreshModifier()->setRefreshOffset(node->uiNodeHandle, item->value[0].f32, unit);
11792     return ERROR_CODE_NO_ERROR;
11793 }
11794 
ResetRefreshOffset(ArkUI_NodeHandle node)11795 void ResetRefreshOffset(ArkUI_NodeHandle node)
11796 {
11797     auto* fullImpl = GetFullImpl();
11798     fullImpl->getNodeModifiers()->getRefreshModifier()->resetRefreshOffset(node->uiNodeHandle);
11799 }
11800 
GetRefreshOffset(ArkUI_NodeHandle node)11801 const ArkUI_AttributeItem* GetRefreshOffset(ArkUI_NodeHandle node)
11802 {
11803     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
11804     auto resultValue =
11805         GetFullImpl()->getNodeModifiers()->getRefreshModifier()->getRefreshOffset(node->uiNodeHandle, unit);
11806     g_numberValues[0].f32 = resultValue;
11807     return &g_attributeItem;
11808 }
11809 
SetPullToRefresh(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11810 int32_t SetPullToRefresh(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11811 {
11812     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11813         return ERROR_CODE_PARAM_INVALID;
11814     }
11815     GetFullImpl()->getNodeModifiers()->getRefreshModifier()->setPullToRefresh(
11816         node->uiNodeHandle, item->value[0].i32);
11817     return ERROR_CODE_NO_ERROR;
11818 }
11819 
ResetPullToRefresh(ArkUI_NodeHandle node)11820 void ResetPullToRefresh(ArkUI_NodeHandle node)
11821 {
11822     auto* fullImpl = GetFullImpl();
11823     fullImpl->getNodeModifiers()->getRefreshModifier()->resetPullToRefresh(node->uiNodeHandle);
11824 }
11825 
GetPullToRefresh(ArkUI_NodeHandle node)11826 const ArkUI_AttributeItem* GetPullToRefresh(ArkUI_NodeHandle node)
11827 {
11828     auto resultValue = GetFullImpl()->getNodeModifiers()->getRefreshModifier()->getPullToRefresh(node->uiNodeHandle);
11829     g_numberValues[0].i32 = resultValue;
11830     return &g_attributeItem;
11831 }
11832 // waterFlow attribute
SetLayoutDirection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11833 int32_t SetLayoutDirection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11834 {
11835     if (item->size == 0) {
11836         return ERROR_CODE_PARAM_INVALID;
11837     }
11838     if (!InRegion(NUM_0, NUM_3, item->value[NUM_0].i32)) {
11839         return ERROR_CODE_PARAM_INVALID;
11840     }
11841     auto* fullImpl = GetFullImpl();
11842     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setLayoutDirection(node->uiNodeHandle, item->value[0].i32);
11843     return ERROR_CODE_NO_ERROR;
11844 }
11845 
ResetLayoutDirection(ArkUI_NodeHandle node)11846 void ResetLayoutDirection(ArkUI_NodeHandle node)
11847 {
11848     auto* fullImpl = GetFullImpl();
11849     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetLayoutDirection(node->uiNodeHandle);
11850 }
11851 
GetLayoutDirection(ArkUI_NodeHandle node)11852 const ArkUI_AttributeItem* GetLayoutDirection(ArkUI_NodeHandle node)
11853 {
11854     auto modifier = GetFullImpl()->getNodeModifiers()->getWaterFlowModifier();
11855     g_numberValues[0].i32 = modifier->getLayoutDirection(node->uiNodeHandle);
11856     return &g_attributeItem;
11857 }
11858 
SetColumnsTemplate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11859 int32_t SetColumnsTemplate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11860 {
11861     auto* fullImpl = GetFullImpl();
11862     if (!CheckAttributeString(item)) {
11863         return ERROR_CODE_PARAM_INVALID;
11864     }
11865     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setColumnsTemplate(node->uiNodeHandle, item->string);
11866     return ERROR_CODE_NO_ERROR;
11867 }
11868 
ResetColumnsTemplate(ArkUI_NodeHandle node)11869 void ResetColumnsTemplate(ArkUI_NodeHandle node)
11870 {
11871     auto* fullImpl = GetFullImpl();
11872     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetColumnsTemplate(node->uiNodeHandle);
11873 }
11874 
GetColumnsTemplate(ArkUI_NodeHandle node)11875 const ArkUI_AttributeItem* GetColumnsTemplate(ArkUI_NodeHandle node)
11876 {
11877     auto fullImpl = GetFullImpl();
11878     auto columnsTemplate = fullImpl->getNodeModifiers()->getWaterFlowModifier()->getColumnsTemplate(node->uiNodeHandle);
11879     g_attributeItem.string = columnsTemplate;
11880     return &g_attributeItem;
11881 }
11882 
SetRowsTemplate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11883 int32_t SetRowsTemplate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11884 {
11885     auto* fullImpl = GetFullImpl();
11886     if (!CheckAttributeString(item)) {
11887         return ERROR_CODE_PARAM_INVALID;
11888     }
11889     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setRowsTemplate(node->uiNodeHandle, item->string);
11890     return ERROR_CODE_NO_ERROR;
11891 }
11892 
ResetRowsTemplate(ArkUI_NodeHandle node)11893 void ResetRowsTemplate(ArkUI_NodeHandle node)
11894 {
11895     auto* fullImpl = GetFullImpl();
11896     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setRowsTemplate(node->uiNodeHandle, "1fr");
11897 }
11898 
GetRowsTemplate(ArkUI_NodeHandle node)11899 const ArkUI_AttributeItem* GetRowsTemplate(ArkUI_NodeHandle node)
11900 {
11901     auto fullImpl = GetFullImpl();
11902     auto rowsTemplate = fullImpl->getNodeModifiers()->getWaterFlowModifier()->getRowsTemplate(node->uiNodeHandle);
11903     g_attributeItem.string = rowsTemplate;
11904     return &g_attributeItem;
11905 }
11906 
SetWaterFlowColumnsGap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11907 int32_t SetWaterFlowColumnsGap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11908 {
11909     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
11910     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
11911         return ERROR_CODE_PARAM_INVALID;
11912     }
11913     auto* fullImpl = GetFullImpl();
11914 
11915     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setColumnsGap(
11916         node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr);
11917     return ERROR_CODE_NO_ERROR;
11918 }
11919 
ResetWaterFlowColumnsGap(ArkUI_NodeHandle node)11920 void ResetWaterFlowColumnsGap(ArkUI_NodeHandle node)
11921 {
11922     auto* fullImpl = GetFullImpl();
11923     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetColumnsGap(node->uiNodeHandle);
11924 }
11925 
GetWaterFlowColumnsGap(ArkUI_NodeHandle node)11926 const ArkUI_AttributeItem* GetWaterFlowColumnsGap(ArkUI_NodeHandle node)
11927 {
11928     auto modifier = GetFullImpl()->getNodeModifiers()->getWaterFlowModifier();
11929     g_numberValues[0].f32 = modifier->getColumnsGap(node->uiNodeHandle);
11930     return &g_attributeItem;
11931 }
11932 
SetWaterFlowRowsGap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11933 int32_t SetWaterFlowRowsGap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11934 {
11935     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
11936     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
11937         return ERROR_CODE_PARAM_INVALID;
11938     }
11939     auto* fullImpl = GetFullImpl();
11940     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setRowsGap(
11941         node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr);
11942     return ERROR_CODE_NO_ERROR;
11943 }
11944 
ResetWaterFlowRowsGap(ArkUI_NodeHandle node)11945 void ResetWaterFlowRowsGap(ArkUI_NodeHandle node)
11946 {
11947     auto* fullImpl = GetFullImpl();
11948     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetRowsGap(node->uiNodeHandle);
11949 }
11950 
GetWaterFlowRowsGap(ArkUI_NodeHandle node)11951 const ArkUI_AttributeItem* GetWaterFlowRowsGap(ArkUI_NodeHandle node)
11952 {
11953     auto modifier = GetFullImpl()->getNodeModifiers()->getWaterFlowModifier();
11954     g_numberValues[0].f32 = modifier->getRowsGap(node->uiNodeHandle);
11955     return &g_attributeItem;
11956 }
11957 
SetWaterFlowNodeAdapter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11958 int32_t SetWaterFlowNodeAdapter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11959 {
11960     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
11961     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
11962     auto* nodeAdapter = reinterpret_cast<ArkUINodeAdapterHandle>(item->object);
11963     return GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->setNodeAdapter(node->uiNodeHandle, nodeAdapter);
11964 }
11965 
ResetWaterFlowNodeAdapter(ArkUI_NodeHandle node)11966 void ResetWaterFlowNodeAdapter(ArkUI_NodeHandle node)
11967 {
11968     // already check in entry point.
11969     auto* fullImpl = GetFullImpl();
11970 
11971     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetNodeAdapter(node->uiNodeHandle);
11972 }
11973 
GetWaterFlowNodeAdapter(ArkUI_NodeHandle node)11974 const ArkUI_AttributeItem* GetWaterFlowNodeAdapter(ArkUI_NodeHandle node)
11975 {
11976     ArkUINodeAdapterHandle adapter =
11977         GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getNodeAdapter(node->uiNodeHandle);
11978     g_attributeItem.object = reinterpret_cast<void*>(adapter);
11979     return &g_attributeItem;
11980 }
11981 
SetWaterFlowCachedCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11982 int32_t SetWaterFlowCachedCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11983 {
11984     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
11985     if (item->size != 1) {
11986         return ERROR_CODE_PARAM_INVALID;
11987     }
11988     if (LessNotEqual(item->value[0].i32, NUM_0)) {
11989         return ERROR_CODE_PARAM_INVALID;
11990     }
11991     GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->setCachedCount(node->uiNodeHandle, item->value[0].i32);
11992     return ERROR_CODE_NO_ERROR;
11993 }
11994 
ResetWaterFlowCachedCount(ArkUI_NodeHandle node)11995 void ResetWaterFlowCachedCount(ArkUI_NodeHandle node)
11996 {
11997     // already check in entry point.
11998     auto* fullImpl = GetFullImpl();
11999 
12000     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetCachedCount(node->uiNodeHandle);
12001 }
12002 
GetWaterFlowCachedCount(ArkUI_NodeHandle node)12003 const ArkUI_AttributeItem* GetWaterFlowCachedCount(ArkUI_NodeHandle node)
12004 {
12005     ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getCachedCount(node->uiNodeHandle);
12006     g_numberValues[0].i32 = value;
12007     return &g_attributeItem;
12008 }
12009 
SetWaterFlowFooter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12010 int32_t SetWaterFlowFooter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12011 {
12012     if (!item->object) {
12013         return ERROR_CODE_PARAM_INVALID;
12014     }
12015     auto fullImpl = GetFullImpl();
12016     auto footerNodeHandle = reinterpret_cast<ArkUI_NodeHandle>(item->object);
12017     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterflowFooter(
12018         node->uiNodeHandle, footerNodeHandle->uiNodeHandle);
12019     return ERROR_CODE_NO_ERROR;
12020 }
12021 
ResetWaterFlowFooter(ArkUI_NodeHandle node)12022 void ResetWaterFlowFooter(ArkUI_NodeHandle node)
12023 {
12024     // already check in entry point.
12025     auto* fullImpl = GetFullImpl();
12026     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterflowFooter(node->uiNodeHandle);
12027 }
12028 
SetWaterFlowSectionOption(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12029 int32_t SetWaterFlowSectionOption(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12030 {
12031     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12032     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
12033     if (item->size != 1) {
12034         return ERROR_CODE_PARAM_INVALID;
12035     }
12036     auto* waterFlowSectionOption = reinterpret_cast<ArkUIWaterFlowSectionOption>(item->object);
12037     GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->setSectionOption(
12038         node->uiNodeHandle, item->value[0].i32, waterFlowSectionOption);
12039     return ERROR_CODE_NO_ERROR;
12040 }
12041 
ResetWaterFlowSectionOption(ArkUI_NodeHandle node)12042 void ResetWaterFlowSectionOption(ArkUI_NodeHandle node)
12043 {
12044     // already check in entry point.
12045     auto* fullImpl = GetFullImpl();
12046 
12047     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetSectionOption(node->uiNodeHandle);
12048 }
12049 
GetWaterFlowSectionOption(ArkUI_NodeHandle node)12050 const ArkUI_AttributeItem* GetWaterFlowSectionOption(ArkUI_NodeHandle node)
12051 {
12052     static ArkUI_WaterFlowSectionOption options =
12053         GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getSectionOption(node->uiNodeHandle);
12054     g_attributeItem.object = &options;
12055     return &g_attributeItem;
12056 }
12057 
SetItemConstraintSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12058 int32_t SetItemConstraintSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12059 {
12060     if (item->size != ALLOW_SIZE_4) {
12061         return ERROR_CODE_PARAM_INVALID;
12062     }
12063 
12064     auto* fullImpl = GetFullImpl();
12065     ArkUI_Float32 constraintSize[ALLOW_SIZE_4] = { 0.0f, FLT_MAX, 0.0f, FLT_MAX };
12066     int32_t unit = GetDefaultUnit(node, UNIT_VP);
12067     ArkUI_Int32 units[ALLOW_SIZE_4] = { unit, unit, unit, unit };
12068 
12069     for (int i = 0; i < ALLOW_SIZE_4; ++i) {
12070         if (LessNotEqual(item->value[i].f32, 0.0f)) {
12071             return ERROR_CODE_PARAM_INVALID;
12072         } else {
12073             constraintSize[i] = item->value[i].f32;
12074         }
12075     }
12076     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setItemMinWidth(
12077         node->uiNodeHandle, constraintSize[NUM_0], units[NUM_0], nullptr);
12078     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setItemMaxWidth(
12079         node->uiNodeHandle, constraintSize[NUM_1], units[NUM_1], nullptr);
12080     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setItemMinHeight(
12081         node->uiNodeHandle, constraintSize[NUM_2], units[NUM_2], nullptr);
12082     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setItemMaxHeight(
12083         node->uiNodeHandle, constraintSize[NUM_3], units[NUM_3], nullptr);
12084     return ERROR_CODE_NO_ERROR;
12085 }
12086 
ResetItemConstraintSize(ArkUI_NodeHandle node)12087 void ResetItemConstraintSize(ArkUI_NodeHandle node)
12088 {
12089     auto* fullImpl = GetFullImpl();
12090     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetItemMinWidth(node->uiNodeHandle);
12091     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetItemMaxWidth(node->uiNodeHandle);
12092     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetItemMinHeight(node->uiNodeHandle);
12093     fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetItemMaxHeight(node->uiNodeHandle);
12094 }
12095 
GetItemConstraintSize(ArkUI_NodeHandle node)12096 const ArkUI_AttributeItem* GetItemConstraintSize(ArkUI_NodeHandle node)
12097 {
12098     ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
12099     g_numberValues[NUM_0].f32 =
12100         GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getItemMinWidth(node->uiNodeHandle, unit);
12101     g_numberValues[NUM_1].f32 =
12102         GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getItemMaxWidth(node->uiNodeHandle, unit);
12103     g_numberValues[NUM_2].f32 =
12104         GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getItemMinHeight(node->uiNodeHandle, unit);
12105     g_numberValues[NUM_3].f32 =
12106         GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getItemMaxHeight(node->uiNodeHandle, unit);
12107     return &g_attributeItem;
12108 }
12109 
SetWaterFlowScrollToIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12110 int32_t SetWaterFlowScrollToIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12111 {
12112     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
12113     if (actualSize < NUM_0) {
12114         return ERROR_CODE_PARAM_INVALID;
12115     }
12116     ArkUI_Int32 values[ALLOW_SIZE_3] = { NUM_0, DEFAULT_FALSE, ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_NONE };
12117     values[NUM_0] = item->value[NUM_0].i32;
12118     if (item->size > NUM_1 && InRegion(NUM_0, NUM_1, item->value[NUM_1].i32)) {
12119         values[NUM_1] = item->value[NUM_1].i32;
12120     }
12121     if (item->size > NUM_2 && InRegion(NUM_0, NUM_3, item->value[NUM_2].i32)) {
12122         values[NUM_2] = item->value[NUM_2].i32;
12123     }
12124     if (values[NUM_2] == ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_NONE) {
12125         values[NUM_2] = ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_START;
12126     }
12127     auto* fullImpl = GetFullImpl();
12128     fullImpl->getNodeModifiers()->getWaterFlowModifier()->setScrollToIndex(
12129         node->uiNodeHandle, values[NUM_0], values[NUM_1], values[NUM_2]);
12130     return ERROR_CODE_NO_ERROR;
12131 }
12132 // radio attribute
SetRadioChecked(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12133 int32_t SetRadioChecked(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12134 {
12135     if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
12136         return ERROR_CODE_PARAM_INVALID;
12137     }
12138     auto* fullImpl = GetFullImpl();
12139     fullImpl->getNodeModifiers()->getRadioModifier()->setRadioChecked(node->uiNodeHandle, item->value[0].i32);
12140     return ERROR_CODE_NO_ERROR;
12141 }
12142 
ResetRadioChecked(ArkUI_NodeHandle node)12143 void ResetRadioChecked(ArkUI_NodeHandle node)
12144 {
12145     auto* fullImpl = GetFullImpl();
12146     fullImpl->getNodeModifiers()->getRadioModifier()->resetRadioChecked(node->uiNodeHandle);
12147 }
12148 
GetRadioChecked(ArkUI_NodeHandle node)12149 const ArkUI_AttributeItem* GetRadioChecked(ArkUI_NodeHandle node)
12150 {
12151     auto resultValue = GetFullImpl()->getNodeModifiers()->getRadioModifier()->getRadioChecked(node->uiNodeHandle);
12152     g_numberValues[0].i32 = resultValue;
12153     return &g_attributeItem;
12154 }
12155 
SetRadioStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12156 int32_t SetRadioStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12157 {
12158     if (item->size == 0) {
12159         return ERROR_CODE_PARAM_INVALID;
12160     }
12161 
12162     auto* fullImpl = GetFullImpl();
12163     ArkUI_Uint32 radioStyle[ALLOW_SIZE_3] = { 0xFF007DFF, 0xFF182431, 0xFFFFFFF };
12164     // checkedBackgroundColor
12165     if (item->size > NUM_0) {
12166         radioStyle[NUM_0] = item->value[NUM_0].u32;
12167     }
12168 
12169     // uncheckedBorderColor
12170     if (item->size > NUM_1) {
12171         radioStyle[NUM_1] = item->value[NUM_1].u32;
12172     }
12173 
12174     // indicatorColor
12175     if (item->size > NUM_2) {
12176         radioStyle[NUM_2] = item->value[NUM_2].u32;
12177     }
12178     fullImpl->getNodeModifiers()->getRadioModifier()->setRadioStyle(
12179         node->uiNodeHandle, radioStyle[NUM_0], radioStyle[NUM_1], radioStyle[NUM_2]);
12180     return ERROR_CODE_NO_ERROR;
12181 }
12182 
ResetRadioStyle(ArkUI_NodeHandle node)12183 void ResetRadioStyle(ArkUI_NodeHandle node)
12184 {
12185     auto* fullImpl = GetFullImpl();
12186     fullImpl->getNodeModifiers()->getRadioModifier()->resetRadioStyle(node->uiNodeHandle);
12187 }
12188 
GetRadioStyle(ArkUI_NodeHandle node)12189 const ArkUI_AttributeItem* GetRadioStyle(ArkUI_NodeHandle node)
12190 {
12191     ArkUIRadioStyleOption options;
12192     GetFullImpl()->getNodeModifiers()->getRadioModifier()->getRadioStyle(node->uiNodeHandle, &options);
12193     g_numberValues[NUM_0].u32 = options.checkedBackgroundColor;
12194     g_numberValues[NUM_1].u32 = options.uncheckedBorderColor;
12195     g_numberValues[NUM_2].u32 = options.indicatorColor;
12196     return &g_attributeItem;
12197 }
12198 
SetRadioValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12199 int32_t SetRadioValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12200 {
12201     auto* fullImpl = GetFullImpl();
12202     if (!CheckAttributeString(item)) {
12203         return ERROR_CODE_PARAM_INVALID;
12204     }
12205     fullImpl->getNodeModifiers()->getRadioModifier()->setRadioValue(node->uiNodeHandle, item->string);
12206     return ERROR_CODE_NO_ERROR;
12207 }
12208 
ResetRadioValue(ArkUI_NodeHandle node)12209 void ResetRadioValue(ArkUI_NodeHandle node)
12210 {
12211     auto* fullImpl = GetFullImpl();
12212     fullImpl->getNodeModifiers()->getRadioModifier()->resetRadioValue(node->uiNodeHandle);
12213 }
12214 
GetRadioValue(ArkUI_NodeHandle node)12215 const ArkUI_AttributeItem* GetRadioValue(ArkUI_NodeHandle node)
12216 {
12217     auto fullImpl = GetFullImpl();
12218     auto value = fullImpl->getNodeModifiers()->getRadioModifier()->getRadioValue(node->uiNodeHandle);
12219     g_attributeItem.string = (value != nullptr ? value : EMPTY_STR.c_str());
12220     return &g_attributeItem;
12221 }
12222 
SetRadioGroup(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12223 int32_t SetRadioGroup(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12224 {
12225     auto* fullImpl = GetFullImpl();
12226     if (!CheckAttributeString(item)) {
12227         return ERROR_CODE_PARAM_INVALID;
12228     }
12229     fullImpl->getNodeModifiers()->getRadioModifier()->setRadioGroup(node->uiNodeHandle, item->string);
12230     return ERROR_CODE_NO_ERROR;
12231 }
12232 
ResetRadioGroup(ArkUI_NodeHandle node)12233 void ResetRadioGroup(ArkUI_NodeHandle node)
12234 {
12235     auto* fullImpl = GetFullImpl();
12236     fullImpl->getNodeModifiers()->getRadioModifier()->resetRadioGroup(node->uiNodeHandle);
12237 }
12238 
GetRadioGroup(ArkUI_NodeHandle node)12239 const ArkUI_AttributeItem* GetRadioGroup(ArkUI_NodeHandle node)
12240 {
12241     auto fullImpl = GetFullImpl();
12242     auto value = fullImpl->getNodeModifiers()->getRadioModifier()->getRadioGroup(node->uiNodeHandle);
12243     g_attributeItem.string = (value != nullptr ? value : EMPTY_STR.c_str());
12244     return &g_attributeItem;
12245 }
12246 
12247 // imageAnimator attribute
SetImageAnimatorSrc(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12248 int32_t SetImageAnimatorSrc(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12249 {
12250     if (!CheckAttributeObjectAndSize(item)) {
12251         return ERROR_CODE_PARAM_INVALID;
12252     }
12253     ArkUIImageFrameInfo imageInfos[item->size];
12254     if (!ParseImages(item, imageInfos, node)) {
12255         return ERROR_CODE_PARAM_INVALID;
12256     }
12257 
12258     auto* fullImpl = GetFullImpl();
12259     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setImageAnimatorSrc(
12260         node->uiNodeHandle, imageInfos, item->size);
12261     return ERROR_CODE_NO_ERROR;
12262 }
12263 
ResetImageAnimatorSrc(ArkUI_NodeHandle node)12264 void ResetImageAnimatorSrc(ArkUI_NodeHandle node)
12265 {
12266     auto* fullImpl = GetFullImpl();
12267     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetImages(node->uiNodeHandle);
12268 }
12269 
GetImageAnimatorSrc(ArkUI_NodeHandle node)12270 const ArkUI_AttributeItem* GetImageAnimatorSrc(ArkUI_NodeHandle node)
12271 {
12272     if (!node->imageFrameInfos) {
12273         g_attributeItem.size = 0;
12274     } else {
12275         auto* fullImpl = GetFullImpl();
12276         g_attributeItem.size = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getImagesSize(
12277             node->uiNodeHandle);
12278         g_attributeItem.object = reinterpret_cast<ArkUI_ImageAnimatorFrameInfo**>(node->imageFrameInfos);
12279     }
12280     return &g_attributeItem;
12281 }
12282 
SetImageAnimatorState(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12283 int32_t SetImageAnimatorState(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12284 {
12285     if (item->size == 0) {
12286         return ERROR_CODE_PARAM_INVALID;
12287     }
12288     if (item->value[0].i32 < NUM_0 || item->value[0].i32 > NUM_3) {
12289         return ERROR_CODE_PARAM_INVALID;
12290     }
12291 
12292     auto* fullImpl = GetFullImpl();
12293     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setState(node->uiNodeHandle, item->value[0].i32);
12294     return ERROR_CODE_NO_ERROR;
12295 }
12296 
ResetImageAnimatorState(ArkUI_NodeHandle node)12297 void ResetImageAnimatorState(ArkUI_NodeHandle node)
12298 {
12299     auto* fullImpl = GetFullImpl();
12300     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetState(node->uiNodeHandle);
12301 }
12302 
GetImageAnimatorState(ArkUI_NodeHandle node)12303 const ArkUI_AttributeItem* GetImageAnimatorState(ArkUI_NodeHandle node)
12304 {
12305     auto* fullImpl = GetFullImpl();
12306     int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getState(node->uiNodeHandle);
12307     g_numberValues[NUM_0].i32 = value;
12308     g_attributeItem.size = RETURN_SIZE_ONE;
12309     return &g_attributeItem;
12310 }
12311 
SetImageAnimatorDuration(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12312 int32_t SetImageAnimatorDuration(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12313 {
12314     if (item->size == 0) {
12315         return ERROR_CODE_PARAM_INVALID;
12316     }
12317 
12318     auto* fullImpl = GetFullImpl();
12319     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setDuration(node->uiNodeHandle, item->value[0].i32);
12320     return ERROR_CODE_NO_ERROR;
12321 }
12322 
ResetImageAnimatorDuration(ArkUI_NodeHandle node)12323 void ResetImageAnimatorDuration(ArkUI_NodeHandle node)
12324 {
12325     auto* fullImpl = GetFullImpl();
12326     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetDuration(node->uiNodeHandle);
12327 }
12328 
GetImageAnimatorDuration(ArkUI_NodeHandle node)12329 const ArkUI_AttributeItem* GetImageAnimatorDuration(ArkUI_NodeHandle node)
12330 {
12331     auto* fullImpl = GetFullImpl();
12332     int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getDuration(node->uiNodeHandle);
12333     g_numberValues[NUM_0].i32 = value;
12334     g_attributeItem.size = RETURN_SIZE_ONE;
12335     return &g_attributeItem;
12336 }
12337 
SetImageAnimatorReverse(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12338 int32_t SetImageAnimatorReverse(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12339 {
12340     if (item->size == 0) {
12341         return ERROR_CODE_PARAM_INVALID;
12342     }
12343     if (item->value[0].i32 < DEFAULT_FALSE || item->value[0].i32 > DEFAULT_TRUE) {
12344         return ERROR_CODE_PARAM_INVALID;
12345     }
12346 
12347     auto* fullImpl = GetFullImpl();
12348     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setReverse(
12349         node->uiNodeHandle, static_cast<ArkUI_Uint32>(item->value[0].i32));
12350     return ERROR_CODE_NO_ERROR;
12351 }
12352 
ResetImageAnimatorReverse(ArkUI_NodeHandle node)12353 void ResetImageAnimatorReverse(ArkUI_NodeHandle node)
12354 {
12355     auto* fullImpl = GetFullImpl();
12356     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetReverse(node->uiNodeHandle);
12357 }
12358 
GetImageAnimatorReverse(ArkUI_NodeHandle node)12359 const ArkUI_AttributeItem* GetImageAnimatorReverse(ArkUI_NodeHandle node)
12360 {
12361     auto* fullImpl = GetFullImpl();
12362     int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getIsReverse(node->uiNodeHandle);
12363     g_numberValues[NUM_0].i32 = value;
12364     g_attributeItem.size = RETURN_SIZE_ONE;
12365     return &g_attributeItem;
12366 }
12367 
SetImageAnimatorFixedSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12368 int32_t SetImageAnimatorFixedSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12369 {
12370     if (item->size == 0) {
12371         return ERROR_CODE_PARAM_INVALID;
12372     }
12373     if (item->value[0].i32 < DEFAULT_FALSE || item->value[0].i32 > DEFAULT_TRUE) {
12374         return ERROR_CODE_PARAM_INVALID;
12375     }
12376 
12377     auto* fullImpl = GetFullImpl();
12378     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setFixedSize(
12379         node->uiNodeHandle, static_cast<ArkUI_Uint32>(item->value[0].i32));
12380     return ERROR_CODE_NO_ERROR;
12381 }
12382 
ResetImageAnimatorFixedSize(ArkUI_NodeHandle node)12383 void ResetImageAnimatorFixedSize(ArkUI_NodeHandle node)
12384 {
12385     auto* fullImpl = GetFullImpl();
12386     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetFixedSize(node->uiNodeHandle);
12387 }
12388 
GetImageAnimatorFixedSize(ArkUI_NodeHandle node)12389 const ArkUI_AttributeItem* GetImageAnimatorFixedSize(ArkUI_NodeHandle node)
12390 {
12391     auto* fullImpl = GetFullImpl();
12392     int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getFixedSize(node->uiNodeHandle);
12393     g_numberValues[NUM_0].i32 = value;
12394     g_attributeItem.size = RETURN_SIZE_ONE;
12395     return &g_attributeItem;
12396 }
12397 
SetImageAnimatorFillMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12398 int32_t SetImageAnimatorFillMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12399 {
12400     if (item->size == 0) {
12401         return ERROR_CODE_PARAM_INVALID;
12402     }
12403     if (item->value[0].i32 < NUM_0 || item->value[0].i32 > NUM_3) {
12404         return ERROR_CODE_PARAM_INVALID;
12405     }
12406 
12407     auto* fullImpl = GetFullImpl();
12408     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setFillMode(node->uiNodeHandle, item->value[0].i32);
12409     return ERROR_CODE_NO_ERROR;
12410 }
12411 
ResetImageAnimatorFillMode(ArkUI_NodeHandle node)12412 void ResetImageAnimatorFillMode(ArkUI_NodeHandle node)
12413 {
12414     auto* fullImpl = GetFullImpl();
12415     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetFillMode(node->uiNodeHandle);
12416 }
12417 
GetImageAnimatorFillMode(ArkUI_NodeHandle node)12418 const ArkUI_AttributeItem* GetImageAnimatorFillMode(ArkUI_NodeHandle node)
12419 {
12420     auto* fullImpl = GetFullImpl();
12421     int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getFillMode(node->uiNodeHandle);
12422     g_numberValues[NUM_0].i32 = value;
12423     g_attributeItem.size = RETURN_SIZE_ONE;
12424     return &g_attributeItem;
12425 }
12426 
SetImageAnimatorIterations(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12427 int32_t SetImageAnimatorIterations(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12428 {
12429     if (item->size == 0) {
12430         return ERROR_CODE_PARAM_INVALID;
12431     }
12432 
12433     auto* fullImpl = GetFullImpl();
12434     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setImageAnimatorIteration(
12435         node->uiNodeHandle, item->value[0].i32);
12436     return ERROR_CODE_NO_ERROR;
12437 }
12438 
ResetImageAnimatorIterations(ArkUI_NodeHandle node)12439 void ResetImageAnimatorIterations(ArkUI_NodeHandle node)
12440 {
12441     auto* fullImpl = GetFullImpl();
12442     fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetImageAnimatorIteration(node->uiNodeHandle);
12443 }
12444 
GetImageAnimatorIterations(ArkUI_NodeHandle node)12445 const ArkUI_AttributeItem* GetImageAnimatorIterations(ArkUI_NodeHandle node)
12446 {
12447     auto* fullImpl = GetFullImpl();
12448     int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getIteration(node->uiNodeHandle);
12449     g_numberValues[NUM_0].i32 = value;
12450     g_attributeItem.size = RETURN_SIZE_ONE;
12451     return &g_attributeItem;
12452 }
12453 
12454 // grid attribute
SetGridColumnsTemplate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12455 int32_t SetGridColumnsTemplate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12456 {
12457     auto* fullImpl = GetFullImpl();
12458     if (!CheckAttributeString(item)) {
12459         return ERROR_CODE_PARAM_INVALID;
12460     }
12461     fullImpl->getNodeModifiers()->getGridModifier()->setGridColumnsTemplate(node->uiNodeHandle, item->string);
12462     return ERROR_CODE_NO_ERROR;
12463 }
12464 
ResetGridColumnsTemplate(ArkUI_NodeHandle node)12465 void ResetGridColumnsTemplate(ArkUI_NodeHandle node)
12466 {
12467     auto* fullImpl = GetFullImpl();
12468     fullImpl->getNodeModifiers()->getGridModifier()->resetGridColumnsTemplate(node->uiNodeHandle);
12469 }
12470 
GetGridColumnsTemplate(ArkUI_NodeHandle node)12471 const ArkUI_AttributeItem* GetGridColumnsTemplate(ArkUI_NodeHandle node)
12472 {
12473     auto fullImpl = GetFullImpl();
12474     auto columnsTemplate = fullImpl->getNodeModifiers()->getGridModifier()->getGridColumnsTemplate(node->uiNodeHandle);
12475     g_attributeItem.string = columnsTemplate;
12476     return &g_attributeItem;
12477 }
12478 
SetGridRowsTemplate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12479 int32_t SetGridRowsTemplate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12480 {
12481     auto* fullImpl = GetFullImpl();
12482     if (!CheckAttributeString(item)) {
12483         return ERROR_CODE_PARAM_INVALID;
12484     }
12485     fullImpl->getNodeModifiers()->getGridModifier()->setGridRowsTemplate(node->uiNodeHandle, item->string);
12486     return ERROR_CODE_NO_ERROR;
12487 }
12488 
ResetGridRowsTemplate(ArkUI_NodeHandle node)12489 void ResetGridRowsTemplate(ArkUI_NodeHandle node)
12490 {
12491     auto* fullImpl = GetFullImpl();
12492     fullImpl->getNodeModifiers()->getGridModifier()->resetGridRowsTemplate(node->uiNodeHandle);
12493 }
12494 
GetGridRowsTemplate(ArkUI_NodeHandle node)12495 const ArkUI_AttributeItem* GetGridRowsTemplate(ArkUI_NodeHandle node)
12496 {
12497     auto fullImpl = GetFullImpl();
12498     auto rowsTemplate = fullImpl->getNodeModifiers()->getGridModifier()->getGridRowsTemplate(node->uiNodeHandle);
12499     g_attributeItem.string = rowsTemplate;
12500     return &g_attributeItem;
12501 }
12502 
SetGridColumnsGap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12503 int32_t SetGridColumnsGap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12504 {
12505     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
12506     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
12507         return ERROR_CODE_PARAM_INVALID;
12508     }
12509     auto* fullImpl = GetFullImpl();
12510     ArkUIResourceLength columnGap = { item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr };
12511     fullImpl->getNodeModifiers()->getGridModifier()->setGridColumnsGap(node->uiNodeHandle, &columnGap);
12512     return ERROR_CODE_NO_ERROR;
12513 }
12514 
ResetGridColumnsGap(ArkUI_NodeHandle node)12515 void ResetGridColumnsGap(ArkUI_NodeHandle node)
12516 {
12517     auto* fullImpl = GetFullImpl();
12518     fullImpl->getNodeModifiers()->getGridModifier()->resetGridColumnsGap(node->uiNodeHandle);
12519 }
12520 
GetGridColumnsGap(ArkUI_NodeHandle node)12521 const ArkUI_AttributeItem* GetGridColumnsGap(ArkUI_NodeHandle node)
12522 {
12523     auto modifier = GetFullImpl()->getNodeModifiers()->getGridModifier();
12524     g_numberValues[0].f32 = modifier->getGridColumnsGap(node->uiNodeHandle);
12525     return &g_attributeItem;
12526 }
12527 
SetGridRowsGap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12528 int32_t SetGridRowsGap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12529 {
12530     auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
12531     if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
12532         return ERROR_CODE_PARAM_INVALID;
12533     }
12534     auto* fullImpl = GetFullImpl();
12535     ArkUIResourceLength rowGap = { item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr };
12536     fullImpl->getNodeModifiers()->getGridModifier()->setGridRowsGap(node->uiNodeHandle, &rowGap);
12537     return ERROR_CODE_NO_ERROR;
12538 }
12539 
ResetGridRowsGap(ArkUI_NodeHandle node)12540 void ResetGridRowsGap(ArkUI_NodeHandle node)
12541 {
12542     auto* fullImpl = GetFullImpl();
12543     fullImpl->getNodeModifiers()->getGridModifier()->resetGridRowsGap(node->uiNodeHandle);
12544 }
12545 
GetGridRowsGap(ArkUI_NodeHandle node)12546 const ArkUI_AttributeItem* GetGridRowsGap(ArkUI_NodeHandle node)
12547 {
12548     auto modifier = GetFullImpl()->getNodeModifiers()->getGridModifier();
12549     g_numberValues[0].f32 = modifier->getGridRowsGap(node->uiNodeHandle);
12550     return &g_attributeItem;
12551 }
12552 
SetGridNodeAdapter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12553 int32_t SetGridNodeAdapter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12554 {
12555     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12556     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
12557     auto* nodeAdapter = reinterpret_cast<ArkUINodeAdapterHandle>(item->object);
12558     return GetFullImpl()->getNodeModifiers()->getGridModifier()->setNodeAdapter(node->uiNodeHandle, nodeAdapter);
12559 }
12560 
ResetGridNodeAdapter(ArkUI_NodeHandle node)12561 void ResetGridNodeAdapter(ArkUI_NodeHandle node)
12562 {
12563     // already check in entry point.
12564     auto* fullImpl = GetFullImpl();
12565 
12566     fullImpl->getNodeModifiers()->getGridModifier()->resetNodeAdapter(node->uiNodeHandle);
12567 }
12568 
GetGridNodeAdapter(ArkUI_NodeHandle node)12569 const ArkUI_AttributeItem* GetGridNodeAdapter(ArkUI_NodeHandle node)
12570 {
12571     ArkUINodeAdapterHandle adapter =
12572         GetFullImpl()->getNodeModifiers()->getGridModifier()->getNodeAdapter(node->uiNodeHandle);
12573     g_attributeItem.object = reinterpret_cast<void*>(adapter);
12574     return &g_attributeItem;
12575 }
12576 
SetGridCachedCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12577 int32_t SetGridCachedCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12578 {
12579     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12580     if (item->size != 1) {
12581         return ERROR_CODE_PARAM_INVALID;
12582     }
12583     if (LessNotEqual(item->value[0].i32, NUM_0)) {
12584         return ERROR_CODE_PARAM_INVALID;
12585     }
12586     GetFullImpl()->getNodeModifiers()->getGridModifier()->setCachedCount(node->uiNodeHandle, item->value[0].i32);
12587     return ERROR_CODE_NO_ERROR;
12588 }
12589 
ResetGridCachedCount(ArkUI_NodeHandle node)12590 void ResetGridCachedCount(ArkUI_NodeHandle node)
12591 {
12592     // already check in entry point.
12593     auto* fullImpl = GetFullImpl();
12594 
12595     fullImpl->getNodeModifiers()->getGridModifier()->resetCachedCount(node->uiNodeHandle);
12596 }
12597 
GetGridCachedCount(ArkUI_NodeHandle node)12598 const ArkUI_AttributeItem* GetGridCachedCount(ArkUI_NodeHandle node)
12599 {
12600     ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getGridModifier()->getCachedCount(node->uiNodeHandle);
12601     g_numberValues[0].i32 = value;
12602     return &g_attributeItem;
12603 }
12604 
SetRelativeContainerGuideLine(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12605 int32_t SetRelativeContainerGuideLine(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12606 {
12607     node->guidelineOption = item->object;
12608     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12609     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
12610     auto styles = reinterpret_cast<ArkUI_GuidelineOption*>(item->object);
12611     ArkUI_Int32 size = static_cast<ArkUI_Int32>(styles->styles.size());
12612     std::vector<ArkUIGuidelineStyle> guidelineStyle;
12613     for (int i = 0; i < size; ++i) {
12614         ArkUIGuidelineStyle style;
12615         style.id = styles->styles[i].id.c_str();
12616         style.direction = styles->styles[i].direction;
12617         style.hasStart = styles->styles[i].hasStart;
12618         style.start = styles->styles[i].start;
12619         style.end = styles->styles[i].end;
12620         style.hasEnd = styles->styles[i].hasEnd;
12621         guidelineStyle.push_back(style);
12622     }
12623     GetFullImpl()->getNodeModifiers()->getRelativeContainerModifier()->setGuideLine(
12624         node->uiNodeHandle, guidelineStyle.data(), size);
12625     return ERROR_CODE_NO_ERROR;
12626 }
12627 
SetRelativeContainerBarrier(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12628 int32_t SetRelativeContainerBarrier(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12629 {
12630     node->barrierOption = item->object;
12631     CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12632     CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
12633 
12634     auto styles = reinterpret_cast<ArkUI_BarrierOption*>(item->object);
12635     ArkUI_Int32 size = static_cast<ArkUI_Int32>(styles->styles.size());
12636 
12637     std::vector<ArkUIBarrierStyle> barrierStyle(size);
12638     for (int i = 0; i < size; ++i) {
12639         barrierStyle[i].id = styles->styles[i].id.c_str();
12640         barrierStyle[i].direction = styles->styles[i].direction;
12641         barrierStyle[i].referencedIdSize = static_cast<ArkUI_Int32>(styles->styles[i].referencedId.size());
12642         barrierStyle[i].referencedId = new ArkUI_CharPtr[barrierStyle[i].referencedIdSize];
12643         for (int j = 0; j < barrierStyle[i].referencedIdSize; ++j) {
12644             barrierStyle[i].referencedId[j] = styles->styles[i].referencedId[j].c_str();
12645         }
12646     }
12647 
12648     GetFullImpl()->getNodeModifiers()->getRelativeContainerModifier()->setBarrier(
12649         node->uiNodeHandle, barrierStyle.data(), size);
12650 
12651     for (int i = 0; i < size; ++i) {
12652         delete[] barrierStyle[i].referencedId;
12653     }
12654     return ERROR_CODE_NO_ERROR;
12655 }
12656 
GetRelativeContainerGuideLine(ArkUI_NodeHandle node)12657 const ArkUI_AttributeItem* GetRelativeContainerGuideLine(ArkUI_NodeHandle node)
12658 {
12659     g_attributeItem.object = node->guidelineOption;
12660     return &g_attributeItem;
12661 }
12662 
GetRelativeContainerBarrier(ArkUI_NodeHandle node)12663 const ArkUI_AttributeItem* GetRelativeContainerBarrier(ArkUI_NodeHandle node)
12664 {
12665     g_attributeItem.object = node->barrierOption;
12666     return &g_attributeItem;
12667 }
12668 
ResetRelativeContainerGuideLine(ArkUI_NodeHandle node)12669 void ResetRelativeContainerGuideLine(ArkUI_NodeHandle node)
12670 {
12671     auto* fullImpl = GetFullImpl();
12672     fullImpl->getNodeModifiers()->getRelativeContainerModifier()->resetGuideline(node->uiNodeHandle);
12673     node->guidelineOption = nullptr;
12674 }
12675 
ResetRelativeContainerBarrier(ArkUI_NodeHandle node)12676 void ResetRelativeContainerBarrier(ArkUI_NodeHandle node)
12677 {
12678     auto* fullImpl = GetFullImpl();
12679     fullImpl->getNodeModifiers()->getRelativeContainerModifier()->resetBarrier(node->uiNodeHandle);
12680     node->barrierOption = nullptr;
12681 }
12682 
CheckIfAttributeLegal(ArkUI_NodeHandle node,int32_t type)12683 bool CheckIfAttributeLegal(ArkUI_NodeHandle node, int32_t type)
12684 {
12685     if (node->type == ARKUI_NODE_SPAN) {
12686         auto it = SPAN_ATTRIBUTES_MAP.find(type);
12687         return it != SPAN_ATTRIBUTES_MAP.end();
12688     }
12689     if (node->type == ARKUI_NODE_CUSTOM_SPAN) {
12690         return false;
12691     }
12692     return true;
12693 }
12694 
12695 using Setter = int32_t(ArkUI_NodeHandle node, const ArkUI_AttributeItem* value);
12696 using Getter = const ArkUI_AttributeItem*(ArkUI_NodeHandle node);
12697 using Resetter = void(ArkUI_NodeHandle node);
12698 
SetCommonAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)12699 int32_t SetCommonAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
12700 {
12701     static Setter* setters[] = {
12702         SetWidth,
12703         SetHeight,
12704         SetBackgroundColor,
12705         SetBackgroundImage,
12706         SetPadding,
12707         SetKey,
12708         SetEnabled,
12709         SetMargin,
12710         SetTranslate,
12711         SetScale,
12712         SetRotate,
12713         SetBrightness,
12714         SetSaturate,
12715         SetBlur,
12716         SetLinearGradient,
12717         SetAlign,
12718         SetOpacity,
12719         SetBorderWidth,
12720         SetBorderRadius,
12721         SetBorderColor,
12722         SetBorderStyle,
12723         SetZIndex,
12724         SetVisibility,
12725         SetClip,
12726         SetClipShape,
12727         SetTransform,
12728         SetHitTestBehavior,
12729         SetPosition,
12730         SetShadow,
12731         SetCustomShadow,
12732         SetBackgroundImageSize,
12733         SetBackgroundImageSizeWithStyle,
12734         SetBackgroundBlurStyle,
12735         SetTransformCenter,
12736         SetOpacityTransition,
12737         SetRotateTransition,
12738         SetScaleTransition,
12739         SetTranslateTransition,
12740         SetMoveTransition,
12741         SetFocusable,
12742         SetDefaultFocus,
12743         SetResponseRegion,
12744         SetOverlay,
12745         SetSweepGradient,
12746         SetRadialGradient,
12747         SetMask,
12748         SetBlendMode,
12749         SetDirection,
12750         SetConstraintSize,
12751         SetGrayscale,
12752         SetInvert,
12753         SetSepia,
12754         SetContrast,
12755         SetForegroundColor,
12756         SetOffset,
12757         SetMarkAnchor,
12758         SetBackgroundImagePosition,
12759         SetAlignRules,
12760         SetAlignSelf,
12761         SetFlexGrow,
12762         SetFlexShrink,
12763         SetFlexBasis,
12764         SetAccessibilityGroup,
12765         SetAccessibilityText,
12766         SetAccessibilityLevel,
12767         SetAccessibilityDescription,
12768         SetNeedFocus,
12769         SetAspectRatio,
12770         SetLayoutWeight,
12771         SetDisplayPriority,
12772         SetOutlineWidth,
12773         SetWidthPercent,
12774         SetHeightPercent,
12775         SetPaddingPercent,
12776         SetMarginPercent,
12777         SetGeometryTransition,
12778         SetChainMode,
12779         SetRenderFit,
12780         SetOutlineColor,
12781         SetSize,
12782         SetRenderGroup,
12783         SetColorBlend,
12784         SetForegroundBlurStyle,
12785         SetLayoutRect,
12786         SetFocusOnTouch,
12787         SetBorderWidthPercent,
12788         SetBorderRadiusPercent,
12789         nullptr,
12790         SetAccessibilityActions,
12791         SetAccessibilityRole,
12792         SetAccessibilityState,
12793         SetAccessibilityValue,
12794         SetExpandSafeArea,
12795         SetAreaChangeRatio,
12796         SetTransition,
12797         nullptr,
12798         SetFocusBox,
12799         SetTabStop
12800     };
12801     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
12802         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "common node attribute: %{public}d NOT IMPLEMENT", subTypeId);
12803         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
12804     }
12805     return setters[subTypeId](node, value);
12806 }
12807 
GetCommonAttribute(ArkUI_NodeHandle node,int32_t subTypeId)12808 const ArkUI_AttributeItem* GetCommonAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
12809 {
12810     static Getter* getters[] = {
12811         GetWidth,
12812         GetHeight,
12813         GetBackgroundColor,
12814         GetBackgroundImage,
12815         GetPadding,
12816         GetKey,
12817         GetEnabled,
12818         GetMargin,
12819         GetTranslate,
12820         GetScale,
12821         GetRotate,
12822         GetBrightness,
12823         GetSaturate,
12824         GetBlur,
12825         GetLinearGradient,
12826         GetAlign,
12827         GetOpacity,
12828         GetBorderWidth,
12829         GetBorderRadius,
12830         GetBorderColor,
12831         GetBorderStyle,
12832         GetZIndex,
12833         GetVisibility,
12834         GetClip,
12835         GetClipShape,
12836         GetTransform,
12837         GetHitTestBehavior,
12838         GetPosition,
12839         GetShadow,
12840         GetCustomShadow,
12841         GetBackgroundImageSize,
12842         GetBackgroundImageSizeWithStyle,
12843         GetBackgroundBlurStyle,
12844         GetTransformCenter,
12845         GetOpacityTransition,
12846         GetRotateTransition,
12847         GetScaleTransition,
12848         GetTranslateTransition,
12849         GetMoveTransition,
12850         GetFocusable,
12851         GetDefaultFocus,
12852         GetResponseRegion,
12853         GetOverlay,
12854         GetSweepGradient,
12855         GetRadialGradient,
12856         GetMask,
12857         GetBlendMode,
12858         GetDirection,
12859         GetConstraintSize,
12860         GetGrayscale,
12861         GetInvert,
12862         GetSepia,
12863         GetContrast,
12864         GetForegroundColor,
12865         GetOffset,
12866         GetMarkAnchor,
12867         GetBackgroundImagePosition,
12868         GetAlignRules,
12869         GetAlignSelf,
12870         GetFlexGrow,
12871         GetFlexShrink,
12872         GetFlexBasis,
12873         GetAccessibilityGroup,
12874         GetAccessibilityText,
12875         GetAccessibilityLevel,
12876         GetAccessibilityDescription,
12877         GetNeedFocus,
12878         GetAspectRatio,
12879         GetLayoutWeight,
12880         GetDisplayPriority,
12881         GetOutlineWidth,
12882         GetWidthPercent,
12883         GetHeightPercent,
12884         GetPaddingPercent,
12885         GetMarginPercent,
12886         GetGeometryTransition,
12887         GetChainMode,
12888         GetRenderFit,
12889         GetOutlineColor,
12890         GetSize,
12891         GetRenderGroup,
12892         GetColorBlend,
12893         GetForegroundBlurStyle,
12894         GetLayoutRect,
12895         GetFocusOnTouch,
12896         GetBorderWidthPercent,
12897         GetBorderRadiusPercent,
12898         GetAccessibilityID,
12899         GetAccessibilityActions,
12900         GetAccessibilityRole,
12901         GetAccessibilityState,
12902         GetAccessibilityValue,
12903         GetExpandSafeArea,
12904         GetAreaChangeRatio,
12905         GetTransition,
12906         GetUniqueID,
12907         nullptr,
12908         nullptr,
12909         GetTabStop,
12910     };
12911     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
12912         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "common node attribute: %{public}d NOT IMPLEMENT", subTypeId);
12913         return nullptr;
12914     }
12915     if (!getters[subTypeId]) {
12916         return nullptr;
12917     }
12918     g_attributeItem.size = RETURN_SIZE_ONE;
12919     return getters[subTypeId](node);
12920 }
12921 
ResetCommonAttribute(ArkUI_NodeHandle node,int32_t subTypeId)12922 void ResetCommonAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
12923 {
12924     static Resetter* resetters[] = {
12925         ResetWidth,
12926         ResetHeight,
12927         ResetBackgroundColor,
12928         ResetBackgroundImage,
12929         ResetPadding,
12930         ResetKey,
12931         ResetEnabled,
12932         ResetMargin,
12933         ResetTranslate,
12934         ResetScale,
12935         ResetRotate,
12936         ResetBrightness,
12937         ResetSaturate,
12938         ResetBlur,
12939         ResetLinearGradient,
12940         ResetAlign,
12941         ResetOpacity,
12942         ResetBorderWidth,
12943         ResetBorderRadius,
12944         ResetBorderColor,
12945         ResetBorderStyle,
12946         ResetZIndex,
12947         ResetVisibility,
12948         ResetClip,
12949         ResetClipShape,
12950         ResetTransform,
12951         ResetHitTestBehavior,
12952         ResetPosition,
12953         ResetShadow,
12954         ResetCustomShadow,
12955         ResetBackgroundImageSize,
12956         ResetBackgroundImageSizeWithStyle,
12957         ResetBackgroundBlurStyle,
12958         ResetTransformCenter,
12959         ResetOpacityTransition,
12960         ResetRotateTransition,
12961         ResetScaleTransition,
12962         ResetTranslateTransition,
12963         ResetMoveTransition,
12964         ResetFocusable,
12965         ResetDefaultFocus,
12966         ResetResponseRegion,
12967         ResetOverlay,
12968         ResetSweepGradient,
12969         ResetRadialGradient,
12970         ResetMask,
12971         ResetBlendMode,
12972         ResetDirection,
12973         ResetConstraintSize,
12974         ResetGrayscale,
12975         ResetInvert,
12976         ResetSepia,
12977         ResetContrast,
12978         ResetForegroundColor,
12979         ResetOffset,
12980         ResetMarkAnchor,
12981         ResetBackgroundImagePosition,
12982         ResetAlignRules,
12983         ResetAlignSelf,
12984         ResetFlexGrow,
12985         ResetFlexShrink,
12986         ResetFlexBasis,
12987         ResetAccessibilityGroup,
12988         ResetAccessibilityText,
12989         ResetAccessibilityLevel,
12990         ResetAccessibilityDescription,
12991         nullptr,
12992         ResetAspectRatio,
12993         ResetLayoutWeight,
12994         ResetDisplayPriority,
12995         ResetOutlineWidth,
12996         ResetWidthPercent,
12997         ResetHeightPercent,
12998         ResetPaddingPercent,
12999         ResetMarginPercent,
13000         ResetGeometryTransition,
13001         ResetChainMode,
13002         ResetRenderFit,
13003         ResetOutlineColor,
13004         ResetSize,
13005         ResetRenderGroup,
13006         ResetColorBlend,
13007         ResetForegroundBlurStyle,
13008         ResetLayoutRect,
13009         ResetFocusOnTouch,
13010         ResetBorderWidthPercent,
13011         ResetBorderRadiusPercent,
13012         nullptr,
13013         ResetAccessibilityActions,
13014         ResetAccessibilityRole,
13015         ResetAccessibilityState,
13016         ResetAccessibilityValue,
13017         ResetExpandSafeArea,
13018         ResetAreaChangeRatio,
13019         nullptr,
13020         nullptr,
13021         ResetFocusBox,
13022         ResetTabStop,
13023     };
13024     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13025         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "common node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13026         return;
13027     }
13028     if (resetters[subTypeId]) {
13029         resetters[subTypeId](node);
13030     }
13031 }
13032 
SetTextAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13033 int32_t SetTextAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13034 {
13035     static Setter* setters[] = { SetTextContent, SetFontColor, SetFontSize, SetFontStyle, SetFontWeight, SetLineHeight,
13036         SetDecoration, SetTextCase, SetLetterSpacing, SetMaxLines, SetTextAlign, SetTextOverflow, SetTextFontFamily,
13037         SetTextCopyOption, SetBaseLineOffset, SetTextShadow, SetTextMinFontSize, SetTextMaxFontSize, SetTextFont,
13038         SetTextHeightAdaptivePolicy, SetTextIndent, SetTextWordBreak, SetTextEllipsisMode, SetLineSpacing,
13039         SetFontFeature, SetTextEnableDateDetector, SetTextDataDetectorConfig, SetTextSelectedBackgroundColor,
13040         SetTextContentWithStyledString, SetHalfLeading };
13041     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13042         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13043         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13044     }
13045     return setters[subTypeId](node, value);
13046 }
13047 
GetTextAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13048 const ArkUI_AttributeItem* GetTextAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13049 {
13050     static Getter* getters[] = { GetTextContent, GetFontColor, GetFontSize, GetFontStyle, GetFontWeight, GetLineHeight,
13051         GetDecoration, GetTextCase, GetLetterSpacing, GetMaxLines, GetTextAlign, GetTextOverflow, GetTextFontFamily,
13052         GetTextCopyOption, GetBaseLineOffset, GetTextShadow, GetTextMinFontSize, GetTextMaxFontSize, GetTextFont,
13053         GetTextHeightAdaptivePolicy, GetTextIndent, GetTextWordBreak, GetTextEllipsisMode, GetLineSpacing,
13054         GetFontFeature, GetTextEnableDateDetector, GetTextDataDetectorConfig, GetTextSelectedBackgroundColor, nullptr,
13055         GetHalfLeading };
13056     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*) || !getters[subTypeId]) {
13057         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13058         return nullptr;
13059     }
13060     g_attributeItem.size = RETURN_SIZE_ONE;
13061     return getters[subTypeId](node);
13062 }
13063 
ResetTextAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13064 void ResetTextAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13065 {
13066     static Resetter* resetters[] = { ResetTextContent, ResetFontColor, ResetFontSize, ResetFontStyle, ResetFontWeight,
13067         ResetLineHeight, ResetDecoration, ResetTextCase, ResetLetterSpacing, ResetMaxLines, ResetTextAlign,
13068         ResetTextOverflow, ResetTextFontFamily, ResetTextCopyOption, ResetBaselineOffset, ResetTextShadow,
13069         ResetTextMinFontSize, ResetTextMaxFontSize, ResetTextFont, ResetTextHeightAdaptivePolicy, ResetTextIndent,
13070         ResetTextWordBreak, ResetTextEllipsisMode, ResetLineSpacing, ResetFontFeature, ResetTextEnableDateDetector,
13071         ResetTextDataDetectorConfig, ResetTextSelectedBackgroundColor, ResetTextContentWithStyledString,ResetHalfLeading };
13072     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13073         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13074         return;
13075     }
13076     resetters[subTypeId](node);
13077 }
13078 
SetSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13079 int32_t SetSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13080 {
13081     static Setter* setters[] = { SetSpanContent, SetSpanTextBackgroundStyle, SetBaseLineOffset };
13082     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13083         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13084         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13085     }
13086     return setters[subTypeId](node, value);
13087 }
13088 
GetSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13089 const ArkUI_AttributeItem* GetSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13090 {
13091     static Getter* getters[] = { GetSpanContent, GetSpanTextBackgroundStyle, GetBaseLineOffset };
13092     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13093         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13094         return nullptr;
13095     }
13096     return getters[subTypeId](node);
13097 }
13098 
ResetSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13099 void ResetSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13100 {
13101     static Resetter* resetters[] = { ResetSpanContent, ResetSpanTextBackgroundStyle, ResetBaselineOffset };
13102     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13103         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13104         return;
13105     }
13106     resetters[subTypeId](node);
13107 }
13108 
SetImageSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13109 int32_t SetImageSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13110 {
13111     static Setter* setters[] = { SetImageSpanSrc, SetVerticalAlign, SetAlt, SetImageSpanBaselineOffset };
13112     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13113         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13114         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13115     }
13116     return setters[subTypeId](node, value);
13117 }
13118 
GetImageSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13119 const ArkUI_AttributeItem* GetImageSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13120 {
13121     static Getter* getters[] = { GetImageSpanSrc, GetVerticalAlign, GetAlt, GetImageSpanBaselineOffset };
13122     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13123         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13124         return nullptr;
13125     }
13126     return getters[subTypeId](node);
13127 }
13128 
ResetImageSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13129 void ResetImageSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13130 {
13131     static Resetter* resetters[] = { ResetImageSpanSrc, ResetVerticalAlign, ResetAlt, ResetImageSpanBaselineOffset };
13132     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13133         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13134         return;
13135     }
13136     resetters[subTypeId](node);
13137 }
13138 
SetImageAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13139 int32_t SetImageAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13140 {
13141     static Setter* setters[] = { SetImageSrc, SetObjectFit, SetInterpolation, SetObjectRepeat, SetColorFilter,
13142         SetAutoResize, SetAlt, SetImageDraggable, SetRenderMode, SetFitOriginalSize, SetFillColor, SetResizable };
13143     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13144         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13145         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13146     }
13147     return setters[subTypeId](node, value);
13148 }
13149 
GetImageAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13150 const ArkUI_AttributeItem* GetImageAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13151 {
13152     static Getter* getters[] = { GetImageSrc, GetObjectFit, GetInterpolation, GetObjectRepeat, GetColorFilter,
13153         GetAutoResize, GetAlt, GetImageDraggable, GetRenderMode, GetFitOriginalSize, GetFillColor, GetResizable };
13154     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13155         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13156         return nullptr;
13157     }
13158     return getters[subTypeId](node);
13159 }
13160 
ResetImageAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13161 void ResetImageAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13162 {
13163     static Resetter* resetters[] = { ResetImageSrc, ResetObjectFit, ResetInterpolation, ResetObjectRepeat,
13164         ResetColorFilter, ResetAutoResize, ResetAlt, ResetImageDraggable, ResetRenderMode,
13165         ResetFitOriginalSize, ResetFillColor, ResetResizable };
13166     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13167         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13168         return;
13169     }
13170     resetters[subTypeId](node);
13171 }
13172 
SetToggleAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13173 int32_t SetToggleAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13174 {
13175     static Setter* setters[] = { SetToggleSelectedColor, SetToggleSwitchPointColor, SetToggleValue,
13176         SetToggleUnselectedColor };
13177     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13178         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "toggle node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13179         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13180     }
13181     return setters[subTypeId](node, value);
13182 }
13183 
GetToggleAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13184 const ArkUI_AttributeItem* GetToggleAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13185 {
13186     static Getter* getters[] = { GetToggleSelectedColor, GetToggleSwitchPointColor, GetToggleValue,
13187         GetToggleUnselectedColor };
13188     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13189         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "toggle node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13190         return nullptr;
13191     }
13192     g_attributeItem.size = RETURN_SIZE_ONE;
13193     return getters[subTypeId](node);
13194 }
13195 
ResetToggleAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13196 void ResetToggleAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13197 {
13198     static Resetter* resetters[] = { ResetToggleSelectedColor, ResetToggleSwitchPointColor, ResetToggleValue,
13199         ResetToggleUnselectedColor };
13200     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13201         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "toggle node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13202         return;
13203     }
13204     resetters[subTypeId](node);
13205 }
13206 
SetLoadingProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13207 int32_t SetLoadingProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13208 {
13209     static Setter* setters[] = { SetLoadingProgressColor, SetLoadingProgressEnableLoading };
13210     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13211         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13212         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13213     }
13214     return setters[subTypeId](node, item);
13215 }
13216 
ResetLoadingProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13217 void ResetLoadingProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13218 {
13219     static Resetter* resetters[] = { ResetLoadingProgressColor, ResetLoadingProgressEnableLoading };
13220     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13221         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13222         return;
13223     }
13224     return resetters[subTypeId](node);
13225 }
13226 
GetLoadingProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13227 const ArkUI_AttributeItem* GetLoadingProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13228 {
13229     static Getter* getters[] = { GetLoadingProgressColor, GetLoadingProgressEnableLoading };
13230     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13231         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13232         return &g_attributeItem;
13233     }
13234     return getters[subTypeId](node);
13235 }
13236 
SetTextInputAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13237 int32_t SetTextInputAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13238 {
13239     static Setter* setters[] = { SetTextInputPlaceholder, SetTextInputText, SetCaretColor, SetCaretStyle,
13240         SetShowUnderline, SetMaxLength, SetEnterKeyType, SetPlaceholderColor, SetTextInputPlaceholderFont,
13241         SetEnableKeyboardOnFocus, SetTextInputType, SetSelectedBackgroundColor, SetShowPasswordIcon,
13242         StopTextInputEditing, SetTextInputCancelButton, SetTextInputTextSelection, SetTextInputUnderlineColor,
13243         SetTextInputEnableAutoFill, SetTextInputContentType, SetTextInputPasswordRules, SetTextInputSelectAll,
13244         SetInputFilter, SetTextInputStyle, SetTextInputCaretOffset, nullptr, nullptr,
13245         SetTextInputSelectionMenuHidden, SetBlurOnSubmit, SetInputCustomKeyboard, SetTextInputWordBreak,
13246         SetTextInputShowKeyBoardOnFocus, SetTextInputNumberOfLines };
13247     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13248         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textinput node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13249         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13250     }
13251     return setters[subTypeId](node, value);
13252 }
13253 
GetTextInputAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13254 const ArkUI_AttributeItem* GetTextInputAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13255 {
13256     static Getter* getters[] = { GetTextInputPlaceholder, GetTextInputText, GetCaretColor, GetCaretStyle,
13257         GetShowUnderline, GetMaxLength, GetEnterKeyType, GetPlaceholderColor, GetTextInputPlaceholderFont,
13258         GetEnableKeyboardOnFocus, GetTextInputType, GetSelectedBackgroundColor, GetShowPasswordIcon, GetTextInputEditing,
13259         GetTextInputCancelButton, GetTextInputTextSelection, GetTextInputUnderlineColor, GetTextInputEnableAutoFill,
13260         GetTextInputContentType, GetTextInputPasswordRules, GetTextInputSelectAll, GetInputFilter,
13261         GetTextInputStyle, GetTextInputCaretOffset, GetTextInputContentRect, GetTextInputContentLineCount,
13262         GetTextInputSelectionMenuHidden, GetBlurOnSubmit, GetInputCustomKeyboard, GetTextInputWordBreak,
13263         GetTextInputShowKeyBoardOnFocus, GetTextInputNumberOfLines};
13264     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13265         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textinput node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13266         return nullptr;
13267     }
13268     return getters[subTypeId](node);
13269 }
13270 
ResetTextInputAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13271 void ResetTextInputAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13272 {
13273     static Resetter* setters[] = { ResetTextInputPlaceholder, ResetTextInputText, ResetCaretColor, ResetCaretStyle,
13274         ResetShowUnderline, ResetMaxLength, ResetEnterKeyType, ResetPlaceholderColor, ResetTextInputPlaceholderFont,
13275         ResetEnableKeyboardOnFocus, ResetTextInputType, ResetSelectedBackgroundColor, ResetShowPasswordIcon, nullptr,
13276         ResetTextInputCancelButton, ResetTextInputTextSelection, ResetTextInputUnderlineColor,
13277         ResetTextInputEnableAutoFill, ResetTextInputContentType, ResetTextInputPasswordRules, ResetTextInputSelectAll,
13278         ResetInputFilter, ResetTextInputStyle, ResetTextInputCaretOffset, nullptr, nullptr,
13279         ResetTextInputSelectionMenuHidden, ResetBlurOnSubmit, ResetInputCustomKeyboard, ResetTextInputWordBreak,
13280         ResetTextInputShowKeyBoardOnFocus, ResetTextInputNumberOfLines };
13281     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13282         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textinput node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13283         return;
13284     }
13285     if (setters[subTypeId]) {
13286         setters[subTypeId](node);
13287     }
13288 }
13289 
SetTextAreaAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13290 int32_t SetTextAreaAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13291 {
13292     static Setter* setters[] = { SetTextAreaPlaceholder, SetTextAreaText, SetMaxLength, SetPlaceholderColor,
13293         SetTextAreaPlaceholderFont, SetCaretColor, StopTextAreaEditing, SetTextAreaType, SetTextAreaShowCounter,
13294         SetTextAreaSelectionMenuHidden, SetBlurOnSubmit, SetInputFilter, SetSelectedBackgroundColor,
13295         SetEnterKeyType, SetEnableKeyboardOnFocus, SetTextInputCaretOffset, nullptr, nullptr,
13296         SetTextInputTextSelection, SetTextInputEnableAutoFill, SetTextInputContentType,
13297         SetTextInputShowKeyBoardOnFocus, SetTextInputNumberOfLines};
13298     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13299         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textarea node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13300         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13301     }
13302     return setters[subTypeId](node, value);
13303 }
13304 
GetTextAreaAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13305 const ArkUI_AttributeItem* GetTextAreaAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13306 {
13307     static Getter* getters[] = { GetTextAreaPlaceholder, GetTextAreaText, GetMaxLength, GetPlaceholderColor,
13308         GetTextAreaPlaceholderFont, GetCaretColor, GetTextAreaEditing, GetTextAreaType, GetTextAreaShowCounter,
13309         GetTextAreaSelectionMenuHidden, GetBlurOnSubmit, GetInputFilter, GetSelectedBackgroundColor,
13310         GetEnterKeyType, GetEnableKeyboardOnFocus, GetTextInputCaretOffset, GetTextInputContentRect,
13311         GetTextInputContentLineCount, GetTextInputTextSelection, GetTextInputEnableAutoFill, GetTextInputContentType,
13312         GetTextInputShowKeyBoardOnFocus, GetTextInputNumberOfLines};
13313     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13314         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textarea span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13315         return nullptr;
13316     }
13317     if (!getters[subTypeId]) {
13318         return nullptr;
13319     }
13320     return getters[subTypeId](node);
13321 }
13322 
ResetTextAreaAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13323 void ResetTextAreaAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13324 {
13325     static Resetter* setters[] = { ResetTextAreaPlaceholder, ResetTextAreaText, ResetMaxLength, ResetPlaceholderColor,
13326         ResetTextAreaPlaceholderFont, ResetCaretColor, nullptr, ResetTextAreaType, ResetTextAreaShowCounter,
13327         ResetTextAreaSelectionMenuHidden, ResetBlurOnSubmit, ResetInputFilter, ResetSelectedBackgroundColor,
13328         ResetEnterKeyType, ResetEnableKeyboardOnFocus, ResetTextInputCaretOffset, nullptr, nullptr,
13329         ResetTextInputTextSelection, ResetTextInputEnableAutoFill, ResetTextInputContentType,
13330         ResetTextInputShowKeyBoardOnFocus, ResetTextInputNumberOfLines};
13331     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13332         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textarea node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13333         return;
13334     }
13335     if (setters[subTypeId]) {
13336         setters[subTypeId](node);
13337     }
13338 }
13339 
SetButtonAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13340 int32_t SetButtonAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13341 {
13342     static Setter* setters[] = { SetButtonLabel, SetButtonType };
13343     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13344         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "button node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13345         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13346     }
13347     return setters[subTypeId](node, item);
13348 }
13349 
GetButtonAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13350 const ArkUI_AttributeItem* GetButtonAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13351 {
13352     static Getter* getters[] = { GetButtonLabel, GetButtonType };
13353     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13354         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "button node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13355         return nullptr;
13356     }
13357     g_attributeItem.size = RETURN_SIZE_ONE;
13358     return getters[subTypeId](node);
13359 }
13360 
ResetButtonAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13361 void ResetButtonAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13362 {
13363     static Resetter* resetters[] = { ResetButtonLabel, ResetButtonType };
13364     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13365         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "button node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13366         return;
13367     }
13368     return resetters[subTypeId](node);
13369 }
13370 
SetProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13371 int32_t SetProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13372 {
13373     static Setter* setters[] = { SetProgressValue, SetProgressTotal, SetProgressColor, SetProgressType };
13374     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13375         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "progress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13376         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13377     }
13378     return setters[subTypeId](node, item);
13379 }
13380 
GetProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13381 const ArkUI_AttributeItem* GetProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13382 {
13383     static Getter* getters[] = { GetProgressValue, GetProgressTotal, GetProgressColor, GetProgressType };
13384     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13385         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "progress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13386         return nullptr;
13387     }
13388     g_attributeItem.size = RETURN_SIZE_ONE;
13389     return getters[subTypeId](node);
13390 }
13391 
ResetProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13392 void ResetProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13393 {
13394     static Resetter* resetters[] = { ResetProgressValue, ResetProgressTotal, ResetProgressColor, ResetProgressType };
13395     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13396         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "progress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13397         return;
13398     }
13399     return resetters[subTypeId](node);
13400 }
13401 
SetCheckboxAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13402 int32_t SetCheckboxAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13403 {
13404     static Setter* setters[] = { SetCheckboxSelect, SetCheckboxSelectedColor, SetCheckboxUnSelectedColor,
13405         SetCheckboxMark, SetCheckboxShape };
13406     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13407         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Checkbox node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13408         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13409     }
13410     return setters[subTypeId](node, item);
13411 }
13412 
GetCheckboxAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13413 const ArkUI_AttributeItem* GetCheckboxAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13414 {
13415     static Getter* getters[] = { GetCheckboxSelect, GetCheckboxSelectedColor, GetCheckboxUnSelectedColor,
13416         GetCheckboxMark, GetCheckboxShape };
13417     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13418         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Checkbox node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13419         return nullptr;
13420     }
13421     g_attributeItem.size = RETURN_SIZE_ONE;
13422     return getters[subTypeId](node);
13423 }
13424 
ResetCheckboxAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13425 void ResetCheckboxAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13426 {
13427     static Resetter* resetters[] = { ResetCheckboxSelect, ResetCheckboxSelectedColor, ResetCheckboxUnSelectedColor,
13428         ResetCheckboxMark, ResetCheckboxShape };
13429     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13430         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Checkbox node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13431         return;
13432     }
13433     return resetters[subTypeId](node);
13434 }
13435 
SetXComponentAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13436 int32_t SetXComponentAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13437 {
13438     static Setter* setters[] = {
13439         SetXComponentId,
13440         SetXComponentType,
13441         SetXComponentSurfaceSize,
13442     };
13443     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13444         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "xcomponent node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13445         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13446     }
13447     return setters[subTypeId](node, value);
13448 }
13449 
GetXComponentAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13450 const ArkUI_AttributeItem* GetXComponentAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13451 {
13452     static Getter* getters[] = { GetXComponentId, GetXComponentType, GetXComponentSurfaceSize, };
13453     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13454         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "xcomponent node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13455         return nullptr;
13456     }
13457     g_attributeItem.size = RETURN_SIZE_ONE;
13458     return getters[subTypeId](node);
13459 }
13460 
ResetXComponentAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13461 void ResetXComponentAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13462 {
13463     static Resetter* setters[] = { nullptr, ResetXComponentType, ResetXComponentSurfaceSize };
13464     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13465         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "xcomponent node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13466         return;
13467     }
13468     if (setters[subTypeId]) {
13469         setters[subTypeId](node);
13470     }
13471 }
13472 
SetDatePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13473 int32_t SetDatePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13474 {
13475     static Setter* setters[] = { SetDatePickerLunar, SetDatePickerStart, SetDatePickerEnd, SetDatePickerSelected,
13476         SetDatePickerDisappearTextStyle, SetDatePickerTextStyle, SetDatePickerSelectedTextStyle };
13477     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13478         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "datepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13479         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13480     }
13481     return setters[subTypeId](node, item);
13482 }
13483 
GetDatePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13484 const ArkUI_AttributeItem* GetDatePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13485 {
13486     static Getter* getters[] = { GetDatePickerLunar, GetDatePickerStart, GetDatePickerEnd, GetDatePickerSelected,
13487         GetDatePickerDisappearTextStyle, GetDatePickerTextStyle, GetDatePickerSelectedTextStyle };
13488     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13489         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "datepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13490         return &g_attributeItem;
13491     }
13492     return getters[subTypeId](node);
13493 }
13494 
ResetDatePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13495 void ResetDatePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13496 {
13497     static Resetter* resetters[] = { ResetDatePickerLunar, ResetDatePickerStart, ResetDatePickerEnd,
13498         ResetDatePickerSelected, ResetDatePickerDisappearTextStyle, ResetDatePickerTextStyle,
13499         ResetDatePickerSelectedTextStyle };
13500     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13501         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "datepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13502         return;
13503     }
13504     return resetters[subTypeId](node);
13505 }
13506 
SetTimePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13507 int32_t SetTimePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13508 {
13509     static Setter* setters[] = { SetTimePickerSelected, SetTimePickerUseMilitaryTime,
13510         SetTimePickerDisappearTextStyle, SetTimePickerTextStyle, SetTimePickerSelectedTextStyle };
13511     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13512         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "timepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13513         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13514     }
13515     return setters[subTypeId](node, item);
13516 }
13517 
GetTimePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13518 const ArkUI_AttributeItem* GetTimePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13519 {
13520     static Getter* getters[] = { GetTimePickerSelected, GetTimePickerUseMilitaryTime, GetTimePickerDisappearTextStyle,
13521         GetTimePickerTextStyle, GetTimePickerSelectedTextStyle };
13522     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13523         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13524         return &g_attributeItem;
13525     }
13526     return getters[subTypeId](node);
13527 }
13528 
ResetTimePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13529 void ResetTimePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13530 {
13531     static Resetter* resetters[] = { ResetTimePickerSelected, ResetTimePickerUseMilitaryTime,
13532         ResetTimePickerDisappearTextStyle, ResetTimePickerTextStyle, ResetTimePickerSelectedTextStyle };
13533     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13534         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "timepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13535         return;
13536     }
13537     return resetters[subTypeId](node);
13538 }
13539 
SetTextPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13540 int32_t SetTextPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13541 {
13542     static Setter* setters[] = { SetTextPickerRange, SetTextPickerSelected, SetTextPickerValue,
13543         SetTextPickerDisappearTextStyle, SetTextPickerTextStyle, SetTextPickerSelectedTextStyle,
13544         SetTextPickerSelectedIndex, SetTextPickerCanLoop, SetTextPickerDefaultPickerItemHeight };
13545     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13546         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textpicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13547         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13548     }
13549     return setters[subTypeId](node, item);
13550 }
13551 
GetTextPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13552 const ArkUI_AttributeItem* GetTextPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13553 {
13554     static Getter* getters[] = { GetTextPickerRange, GetTextPickerSelected, GetTextPickerValue,
13555         GetTextPickerDisappearTextStyle, GetTextPickerTextStyle, GetTextPickerSelectedTextStyle,
13556         GetTextPickerSelectedIndex, GetTextPickerCanLoop, GetTextPickerDefaultPickerItemHeight };
13557     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13558         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13559         return &g_attributeItem;
13560     }
13561     return getters[subTypeId](node);
13562 }
13563 
ResetTextPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13564 void ResetTextPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13565 {
13566     static Resetter* resetters[] = { ResetTextPickerRange, ResetTextPickerSelectedIndex, ResetTextPickerValue,
13567         ResetTextPickerDisappearTextStyle, ResetTextPickerTextStyle, ResetTextPickerSelectedTextStyle,
13568         ResetTextPickerSelectedIndex, ResetTextPickerCanLoop, ResetTextPickerDefaultPickerItemHeight };
13569     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13570         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "timepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13571         return;
13572     }
13573     return resetters[subTypeId](node);
13574 }
13575 
SetCalendarPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13576 int32_t SetCalendarPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13577 {
13578     static Setter* setters[] = { SetHintRadius, SetSelectedDate, SetEdgeAlignment, SetCalendarPickerTextStyle };
13579     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13580         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "calendar picker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13581         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13582     }
13583     return setters[subTypeId](node, item);
13584 }
13585 
ResetCalendarPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13586 void ResetCalendarPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13587 {
13588     static Resetter* resetters[] = { ResetHintRadius, ResetSelectedDate, ResetEdgeAlignment,
13589         ResetCalendarPickerTextStyle };
13590     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13591         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "calendar picker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13592         return;
13593     }
13594     return resetters[subTypeId](node);
13595 }
13596 
GetCalendarPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13597 const ArkUI_AttributeItem* GetCalendarPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13598 {
13599     static Getter* getters[] = { GetHintRadius, GetSelectedDate, GetEdgeAlignment, GetCalendarPickerTextStyle };
13600     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13601         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "calendar picker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13602         return nullptr;
13603     }
13604     return getters[subTypeId](node);
13605 }
13606 
SetSliderAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13607 int32_t SetSliderAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13608 {
13609     static Setter* setters[] = {
13610         SetSliderBlockColor,
13611         SetSliderTrackColor,
13612         SetSliderSelectedColor,
13613         SetSliderShowSteps,
13614         SetSliderBlockStyle,
13615         SetSliderValue,
13616         SetSliderMinValue,
13617         SetSliderMaxValue,
13618         SetSliderStep,
13619         SetSliderDirection,
13620         SetSliderReverse,
13621         SetSliderStyle,
13622         SetSliderTrackThickness,
13623         SetSliderValidSlideRange,
13624     };
13625     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13626         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "slider node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13627         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13628     }
13629     return setters[subTypeId](node, item);
13630 }
13631 
GetSliderAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13632 const ArkUI_AttributeItem* GetSliderAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13633 {
13634     static Getter* getters[] = {
13635         GetSliderBlockColor,
13636         GetSliderTrackColor,
13637         GetSliderSelectedColor,
13638         GetSliderShowSteps,
13639         GetSliderBlockStyle,
13640         GetSliderValue,
13641         GetSliderMinValue,
13642         GetSliderMaxValue,
13643         GetSliderStep,
13644         GetSliderDirection,
13645         GetSliderReverse,
13646         GetSliderStyle,
13647         GetSliderTrackThickness,
13648         GetSliderValidSlideRange,
13649     };
13650     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13651         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "slider node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13652         return nullptr;
13653     }
13654     g_attributeItem.size = RETURN_SIZE_ONE;
13655     return getters[subTypeId](node);
13656 }
13657 
ResetSliderAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13658 void ResetSliderAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13659 {
13660     static Resetter* resetters[] = {
13661         ResetSliderBlockColor,
13662         ResetSliderTrackColor,
13663         ResetSliderSelectedColor,
13664         ResetSliderShowSteps,
13665         ResetSliderBlockStyle,
13666         ResetSliderValue,
13667         ResetSliderMinValue,
13668         ResetSliderMaxValue,
13669         ResetSliderStep,
13670         ResetSliderDirection,
13671         ResetSliderReverse,
13672         ResetSliderStyle,
13673         ResetSliderTrackThickness,
13674         ResetSliderValidSlideRange,
13675     };
13676     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13677         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "slider node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13678         return;
13679     }
13680     return resetters[subTypeId](node);
13681 }
13682 
SetRadioAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13683 int32_t SetRadioAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13684 {
13685     static Setter* setters[] = { SetRadioChecked, SetRadioStyle, SetRadioValue, SetRadioGroup };
13686     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13687         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "radio node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13688         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13689     }
13690     return setters[subTypeId](node, item);
13691 }
13692 
GetRadioAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13693 const ArkUI_AttributeItem* GetRadioAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13694 {
13695     static Getter* getters[] = { GetRadioChecked, GetRadioStyle, GetRadioValue, GetRadioGroup };
13696     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13697         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "radio node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13698         return nullptr;
13699     }
13700     g_attributeItem.size = RETURN_SIZE_ONE;
13701     return getters[subTypeId](node);
13702 }
13703 
ResetRadioAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13704 void ResetRadioAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13705 {
13706     static Resetter* resetters[] = { ResetRadioChecked, ResetRadioStyle, ResetRadioValue, ResetRadioGroup };
13707     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13708         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "radio node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13709         return;
13710     }
13711     return resetters[subTypeId](node);
13712 }
13713 
SetImageAnimatorAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13714 int32_t SetImageAnimatorAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13715 {
13716     static Setter* setters[] = { SetImageAnimatorSrc, SetImageAnimatorState, SetImageAnimatorDuration,
13717         SetImageAnimatorReverse, SetImageAnimatorFixedSize, SetImageAnimatorFillMode, SetImageAnimatorIterations };
13718     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13719         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "imageAnimator node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13720         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13721     }
13722     return setters[subTypeId](node, item);
13723 }
13724 
GetImageAnimatorAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13725 const ArkUI_AttributeItem* GetImageAnimatorAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13726 {
13727     static Getter* getters[] = { GetImageAnimatorSrc, GetImageAnimatorState, GetImageAnimatorDuration,
13728         GetImageAnimatorReverse, GetImageAnimatorFixedSize, GetImageAnimatorFillMode, GetImageAnimatorIterations };
13729     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13730         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "imageAnimator node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13731         return nullptr;
13732     }
13733     return getters[subTypeId](node);
13734 }
13735 
ResetImageAnimatorAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13736 void ResetImageAnimatorAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13737 {
13738     static Resetter* setters[] = { ResetImageAnimatorSrc, ResetImageAnimatorState, ResetImageAnimatorDuration,
13739         ResetImageAnimatorReverse, ResetImageAnimatorFixedSize, ResetImageAnimatorFillMode,
13740         ResetImageAnimatorIterations };
13741     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13742         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "imageAnimator node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13743         return;
13744     }
13745     setters[subTypeId](node);
13746 }
13747 
SetStackAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13748 int32_t SetStackAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13749 {
13750     static Setter* setters[] = { SetAlignContent };
13751     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13752         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "stack node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13753         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13754     }
13755     return setters[subTypeId](node, item);
13756 }
13757 
GetStackAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13758 const ArkUI_AttributeItem* GetStackAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13759 {
13760     static Getter* getters[] = { GetAlignContent };
13761     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13762         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "stack node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13763         return nullptr;
13764     }
13765     return getters[subTypeId](node);
13766 }
13767 
ResetStackAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13768 void ResetStackAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13769 {
13770     static Resetter* setters[] = { ResetAlignContent };
13771     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13772         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "stack node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13773         return;
13774     }
13775     setters[subTypeId](node);
13776 }
13777 
SetSwiperAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13778 int32_t SetSwiperAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13779 {
13780     static Setter* setters[] = { SetSwiperLoop, SetSwiperAutoPlay, SetSwiperShowIndicator, SetSwiperInterval,
13781         SetSwiperVertical, SetSwiperDuration, SetSwiperCurve, SetSwiperItemSpace, SetSwiperIndex, SetSwiperDisplayCount,
13782         SetSwiperDisableSwipe, SetSwiperShowDisplayArrow, SetSwiperEffectMode, SetSwiperNodeAdapter,
13783         SetSwiperCachedCount, SetSwiperPrevMargin, SetSwiperNextMargin, SetSwiperIndicator, SetSwiperNestedScroll,
13784         SetSwiperToIndex, SetSwiperIndicatorInteractive };
13785     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13786         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13787         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13788     }
13789     return setters[subTypeId](node, value);
13790 }
13791 
ResetSwiperAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13792 void ResetSwiperAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13793 {
13794     static Resetter* resetters[] = { ResetSwiperLoop, ResetSwiperAutoPlay, ResetSwiperShowIndicator,
13795         ResetSwiperInterval, ResetSwiperVertical, ResetSwiperDuration, ResetSwiperCurve, ResetSwiperItemSpace,
13796         ResetSwiperIndex, ResetSwiperDisplayCount, ResetSwiperDisableSwipe, ResetSwiperShowDisplayArrow,
13797         ResetSwiperEffectMode, ResetSwiperNodeAdapter, ResetSwiperCachedCount, ResetSwiperPrevMargin,
13798         ResetSwiperNextMargin, ResetSwiperIndicator, ResetSwiperNestedScroll, nullptr,
13799         ResetSwiperIndicatorInteractive };
13800     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13801         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13802         return;
13803     }
13804     resetters[subTypeId](node);
13805 }
13806 
GetSwiperAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13807 const ArkUI_AttributeItem* GetSwiperAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13808 {
13809     static Getter* getters[] = { GetSwiperLoop, GetSwiperAutoPlay, GetSwiperShowIndicator, GetSwiperInterval,
13810         GetSwiperVertical, GetSwiperDuration, GetSwiperCurve, GetSwiperItemSpace, GetSwiperIndex, GetSwiperDisplayCount,
13811         GetSwiperDisableSwipe, GetSwiperShowDisplayArrow, GetSwiperEffectMode, GetSwiperNodeAdapter,
13812         GetSwiperCachedCount, GetSwiperPrevMargin, GetSwiperNextMargin, GetSwiperIndicator, GetSwiperNestedScroll,
13813         nullptr, GetSwiperIndicatorInteractive };
13814     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13815         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13816         return nullptr;
13817     }
13818     g_attributeItem.size = RETURN_SIZE_ONE;
13819     return getters[subTypeId](node);
13820 }
13821 
SetScrollAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13822 int32_t SetScrollAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13823 {
13824     static Setter* setters[] = { SetScrollScrollBar, SetScrollScrollBarWidth, SetScrollScrollBarColor,
13825         SetScrollScrollable, SetScrollEdgeEffect, SetScrollEnableScrollInteraction, SetScrollFriction,
13826         SetScrollScrollSnap, SetScrollNestedScroll, SetScrollTo, SetScrollEdge, SetScrollEnablePaging,
13827         SetScrollPage, SetScrollBy, SetScrollFling, SetScrollFadingEdge, nullptr };
13828     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13829         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "scroll node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13830         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13831     }
13832     return setters[subTypeId](node, item);
13833 }
13834 
GetScrollAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13835 const ArkUI_AttributeItem* GetScrollAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13836 {
13837     static Getter* getters[] = { GetScrollScrollBar, GetScrollScrollBarWidth, GetScrollScrollBarColor,
13838         GetScrollScrollable, GetScrollEdgeEffect, GetScrollEnableScrollInteraction, GetScrollFriction,
13839         GetScrollScrollSnap, GetScrollNestedScroll, GetScrollOffset, GetScrollEdge, GetScrollEnablePaging,
13840         nullptr, nullptr, nullptr, GetScrollFadingEdge, GetScrollContentSize };
13841     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13842         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "slider node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13843         return nullptr;
13844     }
13845     g_attributeItem.size = RETURN_SIZE_ONE;
13846     return getters[subTypeId](node);
13847 }
13848 
ResetScrollAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13849 void ResetScrollAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13850 {
13851     static Resetter* resetters[] = { ResetScrollScrollBar, ResetScrollScrollBarWidth, ResetScrollScrollBarColor,
13852         ResetScrollScrollable, ResetScrollEdgeEffect, ResetScrollEnableScrollInteraction, ResetScrollFriction,
13853         ResetScrollScrollSnap, ResetScrollNestedScroll, ResetScrollTo, ResetScrollEdge, ResetScrollEnablePaging,
13854         nullptr, nullptr, nullptr, ResetScrollFadingEdge, nullptr };
13855     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13856         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13857         return;
13858     }
13859     return resetters[subTypeId](node);
13860 }
13861 
SetListAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13862 int32_t SetListAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13863 {
13864     static Setter* setters[] = { SetListDirection, SetListSticky, SetListSpace, SetListNodeAdapter, SetListCachedCount,
13865         SetListScrollToIndex, SetListAlignListItem, SetListChildrenMainSize, SetListInitialIndex, SetListDivider };
13866     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13867         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13868         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13869     }
13870     return setters[subTypeId](node, value);
13871 }
13872 
GetListAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13873 const ArkUI_AttributeItem* GetListAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13874 {
13875     static Getter* getters[] = { GetListDirection, GetListSticky, GetListSpace, GetListNodeAdapter, GetListCachedCount,
13876         nullptr, GetListAlignListItem, nullptr, GetListInitialIndex, GetListDivider };
13877     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13878         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13879         return &g_attributeItem;
13880     }
13881     return getters[subTypeId](node);
13882 }
13883 
ResetListAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13884 void ResetListAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13885 {
13886     static Resetter* resetters[] = { ResetListDirection, ResetListSticky, ResetListSpace, ResetListNodeAdapter,
13887         ResetListCachedCount, nullptr, ResetListAlignListItem, ResetListChildrenMainSize, ResetListInitialIndex,
13888         ResetListDivider };
13889     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13890         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13891         return;
13892     }
13893     return resetters[subTypeId](node);
13894 }
13895 
SetListItemAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13896 int32_t SetListItemAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13897 {
13898     static Setter* setters[] = { SetListItemSwiperAction };
13899     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13900         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "listitem node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13901         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13902     }
13903     return setters[subTypeId](node, item);
13904 }
13905 
ResetListItemAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13906 void ResetListItemAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13907 {
13908     static Resetter* resetters[] = { ResetListItemSwiperAction };
13909     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13910         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "listitem node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13911         return;
13912     }
13913     if (resetters[subTypeId]) {
13914         return resetters[subTypeId](node);
13915     }
13916 }
13917 
SetListItemGroupAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13918 int32_t SetListItemGroupAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13919 {
13920     static Setter* setters[] = { SetListItemGroupHeader, SetListItemGroupFooter, SetListItemGroupDivider,
13921         SetListItemGroupChildrenMainSize };
13922     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13923         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "listitemgroup node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13924         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13925     }
13926     return setters[subTypeId](node, item);
13927 }
13928 
ResetListItemGroupAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13929 void ResetListItemGroupAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13930 {
13931     static Resetter* resetters[] = { nullptr, nullptr, ResetListItemGroupDivider, ResetListItemGroupChildrenMainSize };
13932     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13933         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "ListItemGroup node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13934         return;
13935     }
13936     if (resetters[subTypeId]) {
13937         return resetters[subTypeId](node);
13938     }
13939 }
13940 
GetListItemGroupAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13941 const ArkUI_AttributeItem* GetListItemGroupAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13942 {
13943     static Getter* getters[] = { nullptr, nullptr, GetListItemGroupDivider, nullptr };
13944     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13945         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "ListItemGroup node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13946         return nullptr;
13947     }
13948     g_attributeItem.size = RETURN_SIZE_ONE;
13949     return getters[subTypeId](node);
13950 }
13951 
SetColumnAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13952 int32_t SetColumnAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13953 {
13954     static Setter* setters[] = { SetAlignItems, SetJustifyContent };
13955     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13956         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "column node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13957         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13958     }
13959     return setters[subTypeId](node, item);
13960 }
13961 
ResetColumnAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13962 void ResetColumnAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13963 {
13964     static Resetter* resetters[] = { ResetAlignItems, ResetJustifyContent };
13965     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13966         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "column node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13967         return;
13968     }
13969     return resetters[subTypeId](node);
13970 }
13971 
GetColumnAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13972 const ArkUI_AttributeItem* GetColumnAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13973 {
13974     static Getter* getters[] = { GetAlignItems, GetJustifyContent };
13975     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13976         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "column node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13977         return nullptr;
13978     }
13979     g_attributeItem.size = RETURN_SIZE_ONE;
13980     return getters[subTypeId](node);
13981 }
13982 
SetRowAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13983 int32_t SetRowAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13984 {
13985     static Setter* setters[] = { SetAlignItems, SetJustifyContent };
13986     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13987         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "row node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13988         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13989     }
13990     return setters[subTypeId](node, item);
13991 }
13992 
ResetRowAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13993 void ResetRowAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13994 {
13995     static Resetter* resetters[] = { ResetAlignItems, ResetJustifyContent };
13996     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13997         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "row node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13998         return;
13999     }
14000     return resetters[subTypeId](node);
14001 }
14002 
GetRowAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14003 const ArkUI_AttributeItem* GetRowAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14004 {
14005     static Getter* getters[] = { GetAlignItems, GetJustifyContent };
14006     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14007         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "row node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14008         return nullptr;
14009     }
14010     g_attributeItem.size = RETURN_SIZE_ONE;
14011     return getters[subTypeId](node);
14012 }
14013 
SetFlexAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)14014 int32_t SetFlexAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
14015 {
14016     static Setter* setters[] = { SetFlexOptions };
14017     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
14018         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "flex node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14019         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14020     }
14021     return setters[subTypeId](node, item);
14022 }
14023 
ResetFlexAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14024 void ResetFlexAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14025 {
14026     static Resetter* resetters[] = { ResetFlexOptions };
14027     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
14028         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "flex node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14029         return;
14030     }
14031     return resetters[subTypeId](node);
14032 }
14033 
GetFlexAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14034 const ArkUI_AttributeItem* GetFlexAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14035 {
14036     static Getter* getters[] = { GetFlexOptions };
14037     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14038         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "flex node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14039         return nullptr;
14040     }
14041     g_attributeItem.size = RETURN_SIZE_ONE;
14042     return getters[subTypeId](node);
14043 }
14044 
SetRefreshAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)14045 int32_t SetRefreshAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
14046 {
14047     static Setter* setters[] = { SetRefreshRefreshing, SetRefreshContent, SetRefreshPullDownRatio, SetRefreshOffset,
14048         SetPullToRefresh };
14049     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
14050         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "refresh node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14051         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14052     }
14053     return setters[subTypeId](node, item);
14054 }
14055 
GetRefreshAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14056 const ArkUI_AttributeItem* GetRefreshAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14057 {
14058     static Getter* getters[] = { GetRefreshRefreshing, nullptr, GetRefreshPullDownRatio, GetRefreshOffset,
14059         GetPullToRefresh };
14060     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14061         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "refresh node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14062         return nullptr;
14063     }
14064     g_attributeItem.size = RETURN_SIZE_ONE;
14065     if (getters[subTypeId]) {
14066         return getters[subTypeId](node);
14067     }
14068     return nullptr;
14069 }
14070 
ResetRefreshAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14071 void ResetRefreshAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14072 {
14073     static Resetter* resetters[] = { nullptr, ResetRefreshContent, ResetRefreshPullDownRatio, ResetRefreshOffset,
14074         ResetPullToRefresh };
14075     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
14076         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "refresh node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14077         return;
14078     }
14079     if (resetters[subTypeId]) {
14080         return resetters[subTypeId](node);
14081     }
14082 }
14083 
SetWaterFlowAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)14084 int32_t SetWaterFlowAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
14085 {
14086     static Setter* setters[] = { SetLayoutDirection, SetColumnsTemplate, SetRowsTemplate, SetWaterFlowColumnsGap,
14087         SetWaterFlowRowsGap, SetWaterFlowSectionOption, SetWaterFlowNodeAdapter, SetWaterFlowCachedCount,
14088         SetWaterFlowFooter, SetWaterFlowScrollToIndex, SetItemConstraintSize };
14089     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
14090         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "waterFlow node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14091         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14092     }
14093     return setters[subTypeId](node, item);
14094 }
14095 
ResetWaterFlowAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14096 void ResetWaterFlowAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14097 {
14098     static Resetter* resetters[] = { ResetLayoutDirection, ResetColumnsTemplate, ResetRowsTemplate,
14099         ResetWaterFlowColumnsGap, ResetWaterFlowRowsGap, ResetWaterFlowSectionOption, ResetWaterFlowNodeAdapter,
14100         ResetWaterFlowCachedCount, ResetWaterFlowFooter, nullptr, ResetItemConstraintSize };
14101     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
14102         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "waterFlow node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14103         return;
14104     }
14105     return resetters[subTypeId](node);
14106 }
14107 
GetWaterFlowAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14108 const ArkUI_AttributeItem* GetWaterFlowAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14109 {
14110     static Getter* getters[] = { GetLayoutDirection, GetColumnsTemplate, GetRowsTemplate, GetWaterFlowColumnsGap,
14111         GetWaterFlowRowsGap, GetWaterFlowSectionOption, GetWaterFlowNodeAdapter, GetWaterFlowCachedCount,
14112         nullptr, nullptr, GetItemConstraintSize };
14113     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14114         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "waterFlow node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14115         return nullptr;
14116     }
14117     g_attributeItem.size = RETURN_SIZE_ONE;
14118     return getters[subTypeId](node);
14119 }
14120 
SetRelativeContainerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)14121 int32_t SetRelativeContainerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
14122 {
14123     static Setter* setters[] = { SetRelativeContainerGuideLine, SetRelativeContainerBarrier };
14124     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
14125         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "RelativeContainer node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14126         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14127     }
14128     return setters[subTypeId](node, item);
14129 }
14130 
ResetRelativeContainerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14131 void ResetRelativeContainerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14132 {
14133     static Resetter* resetters[] = { ResetRelativeContainerGuideLine, ResetRelativeContainerBarrier };
14134     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
14135         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "RelativeContainer node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14136         return;
14137     }
14138     return resetters[subTypeId](node);
14139 }
14140 
GetRelativeContainerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14141 const ArkUI_AttributeItem* GetRelativeContainerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14142 {
14143     static Getter* getters[] = { GetRelativeContainerGuideLine, GetRelativeContainerBarrier };
14144     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14145         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "RelativeContainer node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14146         return nullptr;
14147     }
14148     g_attributeItem.size = RETURN_SIZE_ONE;
14149     return getters[subTypeId](node);
14150 }
14151 
SetGridAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)14152 int32_t SetGridAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
14153 {
14154     static Setter* setters[] = { SetGridColumnsTemplate, SetGridRowsTemplate, SetGridColumnsGap, SetGridRowsGap,
14155         SetGridNodeAdapter, SetGridCachedCount };
14156     if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
14157         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Grid node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14158         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14159     }
14160     return setters[subTypeId](node, item);
14161 }
14162 
ResetGridAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14163 void ResetGridAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14164 {
14165     static Resetter* resetters[] = { ResetGridColumnsTemplate, ResetGridRowsTemplate, ResetGridColumnsGap,
14166         ResetGridRowsGap, ResetGridNodeAdapter, ResetGridCachedCount };
14167     if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
14168         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Grid node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14169         return;
14170     }
14171     return resetters[subTypeId](node);
14172 }
14173 
GetGridAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14174 const ArkUI_AttributeItem* GetGridAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14175 {
14176     static Getter* getters[] = { GetGridColumnsTemplate, GetGridRowsTemplate, GetGridColumnsGap, GetGridRowsGap,
14177         GetGridNodeAdapter, GetGridCachedCount };
14178     if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14179         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Grid node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14180         return nullptr;
14181     }
14182     g_attributeItem.size = RETURN_SIZE_ONE;
14183     return getters[subTypeId](node);
14184 }
14185 } // namespace
14186 
SetNodeAttribute(ArkUI_NodeHandle node,ArkUI_NodeAttributeType type,const ArkUI_AttributeItem * item)14187 int32_t SetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type, const ArkUI_AttributeItem* item)
14188 {
14189     using AttributeSetterClass = int32_t(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item);
14190     static AttributeSetterClass* setterClasses[] = {
14191         SetCommonAttribute,
14192         SetTextAttribute,
14193         SetSpanAttribute,
14194         SetImageSpanAttribute,
14195         SetImageAttribute,
14196         SetToggleAttribute,
14197         SetLoadingProgressAttribute,
14198         SetTextInputAttribute,
14199         SetTextAreaAttribute,
14200         SetButtonAttribute,
14201         SetProgressAttribute,
14202         SetCheckboxAttribute,
14203         SetXComponentAttribute,
14204         SetDatePickerAttribute,
14205         SetTimePickerAttribute,
14206         SetTextPickerAttribute,
14207         SetCalendarPickerAttribute,
14208         SetSliderAttribute,
14209         SetRadioAttribute,
14210         SetImageAnimatorAttribute,
14211         SetStackAttribute,
14212         SetSwiperAttribute,
14213         SetScrollAttribute,
14214         SetListAttribute,
14215         SetListItemAttribute,
14216         SetListItemGroupAttribute,
14217         SetColumnAttribute,
14218         SetRowAttribute,
14219         SetFlexAttribute,
14220         SetRefreshAttribute,
14221         SetWaterFlowAttribute,
14222         nullptr,
14223         SetRelativeContainerAttribute,
14224         SetGridAttribute
14225     };
14226     int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
14227     int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
14228     int32_t nodeSubTypeClass =
14229         subTypeClass < MAX_NODE_SCOPE_NUM ? subTypeClass : (subTypeClass - MAX_NODE_SCOPE_NUM + BASIC_COMPONENT_NUM);
14230     if ((static_cast<uint32_t>(nodeSubTypeClass) >= sizeof(setterClasses) / sizeof(AttributeSetterClass*)) ||
14231         !CheckIfAttributeLegal(node, type) || !CheckIsCNode(node)) {
14232         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14233     }
14234     if (!setterClasses[nodeSubTypeClass]) {
14235         return ERROR_CODE_PARAM_INVALID;
14236     }
14237     auto result = setterClasses[nodeSubTypeClass](node, subTypeId, item);
14238     if (result == ERROR_CODE_NO_ERROR) {
14239         GetFullImpl()->getBasicAPI()->markDirty(node->uiNodeHandle, ARKUI_DIRTY_FLAG_ATTRIBUTE_DIFF);
14240     }
14241     return result;
14242 }
14243 
GetNodeAttribute(ArkUI_NodeHandle node,ArkUI_NodeAttributeType type)14244 const ArkUI_AttributeItem* GetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type)
14245 {
14246     ResetAttributeItem();
14247     using AttributeGetterClass = const ArkUI_AttributeItem*(ArkUI_NodeHandle node, int32_t subTypeId);
14248     static AttributeGetterClass* getterClasses[] = { GetCommonAttribute, GetTextAttribute, GetSpanAttribute,
14249         GetImageSpanAttribute, GetImageAttribute, GetToggleAttribute, GetLoadingProgressAttribute,
14250         GetTextInputAttribute, GetTextAreaAttribute, GetButtonAttribute, GetProgressAttribute, GetCheckboxAttribute,
14251         GetXComponentAttribute, GetDatePickerAttribute, GetTimePickerAttribute, GetTextPickerAttribute,
14252         GetCalendarPickerAttribute, GetSliderAttribute, GetRadioAttribute, GetImageAnimatorAttribute, GetStackAttribute,
14253         GetSwiperAttribute, GetScrollAttribute, GetListAttribute, nullptr, GetListItemGroupAttribute,
14254         GetColumnAttribute, GetRowAttribute, GetFlexAttribute, GetRefreshAttribute, GetWaterFlowAttribute, nullptr,
14255         GetRelativeContainerAttribute, GetGridAttribute };
14256     int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
14257     int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
14258     int32_t nodeSubTypeClass =
14259         subTypeClass < MAX_NODE_SCOPE_NUM ? subTypeClass : (subTypeClass - MAX_NODE_SCOPE_NUM + BASIC_COMPONENT_NUM);
14260     if ((static_cast<uint32_t>(nodeSubTypeClass) >= sizeof(getterClasses) / sizeof(AttributeGetterClass*)) ||
14261         !CheckIfAttributeLegal(node, type)) {
14262         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "node attribute: %{public}d NOT IMPLEMENT", type);
14263         return nullptr;
14264     }
14265     if (!getterClasses[nodeSubTypeClass]) {
14266         return nullptr;
14267     }
14268     return getterClasses[nodeSubTypeClass](node, subTypeId);
14269 }
14270 
ResetNodeAttribute(ArkUI_NodeHandle node,ArkUI_NodeAttributeType type)14271 int32_t ResetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type)
14272 {
14273     using AttributeResetterClass = void(ArkUI_NodeHandle node, int32_t subTypeId);
14274     static AttributeResetterClass* resetterClasses[] = {
14275         ResetCommonAttribute,
14276         ResetTextAttribute,
14277         ResetSpanAttribute,
14278         ResetImageSpanAttribute,
14279         ResetImageAttribute,
14280         ResetToggleAttribute,
14281         ResetLoadingProgressAttribute,
14282         ResetTextInputAttribute,
14283         ResetTextAreaAttribute,
14284         ResetButtonAttribute,
14285         ResetProgressAttribute,
14286         ResetCheckboxAttribute,
14287         ResetXComponentAttribute,
14288         ResetDatePickerAttribute,
14289         ResetTimePickerAttribute,
14290         ResetTextPickerAttribute,
14291         ResetCalendarPickerAttribute,
14292         ResetSliderAttribute,
14293         ResetRadioAttribute,
14294         ResetImageAnimatorAttribute,
14295         ResetStackAttribute,
14296         ResetSwiperAttribute,
14297         ResetScrollAttribute,
14298         ResetListAttribute,
14299         ResetListItemAttribute,
14300         ResetListItemGroupAttribute,
14301         ResetColumnAttribute,
14302         ResetRowAttribute,
14303         ResetFlexAttribute,
14304         ResetRefreshAttribute,
14305         ResetWaterFlowAttribute,
14306         nullptr,
14307         ResetRelativeContainerAttribute,
14308         ResetGridAttribute
14309     };
14310     int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
14311     int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
14312     int32_t nodeSubTypeClass =
14313         subTypeClass < MAX_NODE_SCOPE_NUM ? subTypeClass : (subTypeClass - MAX_NODE_SCOPE_NUM + BASIC_COMPONENT_NUM);
14314     if ((static_cast<uint32_t>(nodeSubTypeClass) >= sizeof(resetterClasses) / sizeof(AttributeResetterClass*)) ||
14315         !CheckIfAttributeLegal(node, type) || !CheckIsCNode(node)) {
14316         TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "node attribute: %{public}d NOT IMPLEMENT", type);
14317         return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14318     }
14319     if (!resetterClasses[nodeSubTypeClass]) {
14320         return ERROR_CODE_PARAM_INVALID;
14321     }
14322     resetterClasses[nodeSubTypeClass](node, subTypeId);
14323     GetFullImpl()->getBasicAPI()->markDirty(node->uiNodeHandle, ARKUI_DIRTY_FLAG_ATTRIBUTE_DIFF);
14324     return ERROR_CODE_NO_ERROR;
14325 }
14326 
14327 } // namespace OHOS::Ace::NodeModel