Object/ListBox.pm untested

filter: Statementstmt 0.0% 0 / 99 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 20 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 134 CC 6 SCAR 15.5
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 4.7
1 =begin comment
2
3 Copyright (c) 2026 Aspose.Cells Cloud
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21
22 =end comment
23
24 =cut
25
26 package AsposeCellsCloud::Object::ListBox;
27
28 require 5.6.0;
29 use strict;
30 use warnings;
31 use utf8;
32 use JSON qw(decode_json);
33 use Data::Dumper;
34 use Module::Runtime qw(use_module);
35 use Log::Any qw($log);
36 use Date::Parse;
37 use DateTime;
38 use AsposeCellsCloud::Object::Font;
39 use AsposeCellsCloud::Object::Link;
40 use AsposeCellsCloud::Object::LinkElement;
41 use AsposeCellsCloud::Object::Shape;
42
43
44 use base ("Class::Accessor", "Class::Data::Inheritable");
45
46
47
48 __PACKAGE__->mk_classdata('attribute_map' => {});
49 __PACKAGE__->mk_classdata('swagger_types' => {});
50 __PACKAGE__->mk_classdata('method_documentation' => {});
51 __PACKAGE__->mk_classdata('class_documentation' => {});
52
53 # new object
54 sub new {
55 my ($class, %args) = @_;
56
57 my $self = bless {}, $class;
58
59 foreach my $attribute (keys %{$class->attribute_map}) {
60 my $args_key = $class->attribute_map->{$attribute};
61 $self->$attribute( $args{ $args_key } );
62 }
63
64 return $self;
65 }
66
67 # return perl hash
68 sub to_hash {
69 return decode_json(JSON->new->convert_blessed->encode( shift ));
70 }
71
72 # used by JSON for serialization
73 sub TO_JSON {
74 my $self = shift;
75 my $_data = {};
76 foreach my $_key (keys %{$self->attribute_map}) {
77 if (defined $self->{$_key}) {
78 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
79 }
80 }
81 return $_data;
82 }
83
84 # from Perl hashref
85 sub from_hash {
86 my ($self, $hash) = @_;
87
88 # loop through attributes and use swagger_types to deserialize the data
89 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
90 my $_json_attribute = $self->attribute_map->{$_key};
91 if ($_type =~ /^array\[/i) { # array
92 my $_subclass = substr($_type, 6, -1);
93 my @_array = ();
94 foreach my $_element (@{$hash->{$_json_attribute}}) {
95 push @_array, $self->_deserialize($_subclass, $_element);
96 }
97 $self->{$_key} = \@_array;
98 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
99 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
100 } else {
101 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
102 }
103 }
104
105 return $self;
106 }
107
108 # deserialize non-array data
109 sub _deserialize {
110 my ($self, $type, $data) = @_;
111 $log->debugf("deserializing %s with %s",Dumper($data), $type);
112
113 if ($type eq 'DateTime') {
114 return DateTime->from_epoch(epoch => str2time($data));
115 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
116 return $data;
117 } else { # hash(model)
118 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
119 return $_instance->from_hash($data);
120 }
121 }
122
123
124 __PACKAGE__->class_documentation({description => 'Represents a list box object.',
125 class => 'ListBox',
126 required => [], # TODO
127 } );
128
129
130 __PACKAGE__->method_documentation({
131 'input_range' => {
132 datatype => 'string',
133 base_name => 'InputRange',
134 description => 'This property stores the input range for the class.',
135 format => '',
136 read_only => '',
137 },
138 'item_count' => {
139 datatype => 'int',
140 base_name => 'ItemCount',
141 description => 'Gets the number of items in the list box.',
142 format => '',
143 read_only => '',
144 },
145 'page_change' => {
146 datatype => 'int',
147 base_name => 'PageChange',
148 description => 'Specifies the amount by which the control`s value is changed when the user clicks on the scrollbar`s page up or page down region.',
149 format => '',
150 read_only => '',
151 },
152 'selected_cells' => {
153 datatype => 'ARRAY[LinkElement]',
154 base_name => 'SelectedCells',
155 description => 'Gets the selected cells. Returns null if the input range is not set or no item is selected',
156 format => '',
157 read_only => '',
158 },
159 'selected_index' => {
160 datatype => 'int',
161 base_name => 'SelectedIndex',
162 description => 'Gets or sets the index number of the currently selected item in a list box or combo box. Zero-based.',
163 format => '',
164 read_only => '',
165 },
166 'selection_type' => {
167 datatype => 'string',
168 base_name => 'SelectionType',
169 description => 'Gets or sets the selection mode of the specified list box.',
170 format => '',
171 read_only => '',
172 },
173 'shadow' => {
174 datatype => 'boolean',
175 base_name => 'Shadow',
176 description => 'Indicates whether the combobox has 3-D shading.',
177 format => '',
178 read_only => '',
179 },
180 'name' => {
181 datatype => 'string',
182 base_name => 'Name',
183 description => '',
184 format => '',
185 read_only => '',
186 },
187 'mso_drawing_type' => {
188 datatype => 'string',
189 base_name => 'MsoDrawingType',
190 description => '',
191 format => '',
192 read_only => '',
193 },
194 'auto_shape_type' => {
195 datatype => 'string',
196 base_name => 'AutoShapeType',
197 description => '',
198 format => '',
199 read_only => '',
200 },
201 'placement' => {
202 datatype => 'string',
203 base_name => 'Placement',
204 description => '',
205 format => '',
206 read_only => '',
207 },
208 'upper_left_row' => {
209 datatype => 'int',
210 base_name => 'UpperLeftRow',
211 description => '',
212 format => '',
213 read_only => '',
214 },
215 'top' => {
216 datatype => 'int',
217 base_name => 'Top',
218 description => '',
219 format => '',
220 read_only => '',
221 },
222 'upper_left_column' => {
223 datatype => 'int',
224 base_name => 'UpperLeftColumn',
225 description => '',
226 format => '',
227 read_only => '',
228 },
229 'left' => {
230 datatype => 'int',
231 base_name => 'Left',
232 description => '',
233 format => '',
234 read_only => '',
235 },
236 'lower_right_row' => {
237 datatype => 'int',
238 base_name => 'LowerRightRow',
239 description => '',
240 format => '',
241 read_only => '',
242 },
243 'bottom' => {
244 datatype => 'int',
245 base_name => 'Bottom',
246 description => '',
247 format => '',
248 read_only => '',
249 },
250 'lower_right_column' => {
251 datatype => 'int',
252 base_name => 'LowerRightColumn',
253 description => '',
254 format => '',
255 read_only => '',
256 },
257 'right' => {
258 datatype => 'int',
259 base_name => 'Right',
260 description => '',
261 format => '',
262 read_only => '',
263 },
264 'width' => {
265 datatype => 'int',
266 base_name => 'Width',
267 description => '',
268 format => '',
269 read_only => '',
270 },
271 'height' => {
272 datatype => 'int',
273 base_name => 'Height',
274 description => '',
275 format => '',
276 read_only => '',
277 },
278 'x' => {
279 datatype => 'int',
280 base_name => 'X',
281 description => '',
282 format => '',
283 read_only => '',
284 },
285 'y' => {
286 datatype => 'int',
287 base_name => 'Y',
288 description => '',
289 format => '',
290 read_only => '',
291 },
292 'rotation_angle' => {
293 datatype => 'double',
294 base_name => 'RotationAngle',
295 description => '',
296 format => '',
297 read_only => '',
298 },
299 'html_text' => {
300 datatype => 'string',
301 base_name => 'HtmlText',
302 description => '',
303 format => '',
304 read_only => '',
305 },
306 'text' => {
307 datatype => 'string',
308 base_name => 'Text',
309 description => '',
310 format => '',
311 read_only => '',
312 },
313 'alternative_text' => {
314 datatype => 'string',
315 base_name => 'AlternativeText',
316 description => '',
317 format => '',
318 read_only => '',
319 },
320 'text_horizontal_alignment' => {
321 datatype => 'string',
322 base_name => 'TextHorizontalAlignment',
323 description => '',
324 format => '',
325 read_only => '',
326 },
327 'text_horizontal_overflow' => {
328 datatype => 'string',
329 base_name => 'TextHorizontalOverflow',
330 description => '',
331 format => '',
332 read_only => '',
333 },
334 'text_orientation_type' => {
335 datatype => 'string',
336 base_name => 'TextOrientationType',
337 description => '',
338 format => '',
339 read_only => '',
340 },
341 'text_vertical_alignment' => {
342 datatype => 'string',
343 base_name => 'TextVerticalAlignment',
344 description => '',
345 format => '',
346 read_only => '',
347 },
348 'text_vertical_overflow' => {
349 datatype => 'string',
350 base_name => 'TextVerticalOverflow',
351 description => '',
352 format => '',
353 read_only => '',
354 },
355 'is_group' => {
356 datatype => 'boolean',
357 base_name => 'IsGroup',
358 description => '',
359 format => '',
360 read_only => '',
361 },
362 'is_hidden' => {
363 datatype => 'boolean',
364 base_name => 'IsHidden',
365 description => '',
366 format => '',
367 read_only => '',
368 },
369 'is_lock_aspect_ratio' => {
370 datatype => 'boolean',
371 base_name => 'IsLockAspectRatio',
372 description => '',
373 format => '',
374 read_only => '',
375 },
376 'is_locked' => {
377 datatype => 'boolean',
378 base_name => 'IsLocked',
379 description => '',
380 format => '',
381 read_only => '',
382 },
383 'is_printable' => {
384 datatype => 'boolean',
385 base_name => 'IsPrintable',
386 description => '',
387 format => '',
388 read_only => '',
389 },
390 'is_text_wrapped' => {
391 datatype => 'boolean',
392 base_name => 'IsTextWrapped',
393 description => '',
394 format => '',
395 read_only => '',
396 },
397 'is_word_art' => {
398 datatype => 'boolean',
399 base_name => 'IsWordArt',
400 description => '',
401 format => '',
402 read_only => '',
403 },
404 'linked_cell' => {
405 datatype => 'string',
406 base_name => 'LinkedCell',
407 description => '',
408 format => '',
409 read_only => '',
410 },
411 'z_order_position' => {
412 datatype => 'int',
413 base_name => 'ZOrderPosition',
414 description => '',
415 format => '',
416 read_only => '',
417 },
418 'font' => {
419 datatype => 'Font',
420 base_name => 'Font',
421 description => '',
422 format => '',
423 read_only => '',
424 },
425 'hyperlink' => {
426 datatype => 'string',
427 base_name => 'Hyperlink',
428 description => '',
429 format => '',
430 read_only => '',
431 },
432 'link' => {
433 datatype => 'Link',
434 base_name => 'link',
435 description => '',
436 format => '',
437 read_only => '',
438 },
439 });
440
441 __PACKAGE__->swagger_types( {
442 'input_range' => 'string',
443 'item_count' => 'int',
444 'page_change' => 'int',
445 'selected_cells' => 'ARRAY[LinkElement]',
446 'selected_index' => 'int',
447 'selection_type' => 'string',
448 'shadow' => 'boolean',
449 'name' => 'string',
450 'mso_drawing_type' => 'string',
451 'auto_shape_type' => 'string',
452 'placement' => 'string',
453 'upper_left_row' => 'int',
454 'top' => 'int',
455 'upper_left_column' => 'int',
456 'left' => 'int',
457 'lower_right_row' => 'int',
458 'bottom' => 'int',
459 'lower_right_column' => 'int',
460 'right' => 'int',
461 'width' => 'int',
462 'height' => 'int',
463 'x' => 'int',
464 'y' => 'int',
465 'rotation_angle' => 'double',
466 'html_text' => 'string',
467 'text' => 'string',
468 'alternative_text' => 'string',
469 'text_horizontal_alignment' => 'string',
470 'text_horizontal_overflow' => 'string',
471 'text_orientation_type' => 'string',
472 'text_vertical_alignment' => 'string',
473 'text_vertical_overflow' => 'string',
474 'is_group' => 'boolean',
475 'is_hidden' => 'boolean',
476 'is_lock_aspect_ratio' => 'boolean',
477 'is_locked' => 'boolean',
478 'is_printable' => 'boolean',
479 'is_text_wrapped' => 'boolean',
480 'is_word_art' => 'boolean',
481 'linked_cell' => 'string',
482 'z_order_position' => 'int',
483 'font' => 'Font',
484 'hyperlink' => 'string',
485 'link' => 'Link'
486 } );
487
488 __PACKAGE__->attribute_map( {
489 'input_range' => 'InputRange',
490 'item_count' => 'ItemCount',
491 'page_change' => 'PageChange',
492 'selected_cells' => 'SelectedCells',
493 'selected_index' => 'SelectedIndex',
494 'selection_type' => 'SelectionType',
495 'shadow' => 'Shadow',
496 'name' => 'Name',
497 'mso_drawing_type' => 'MsoDrawingType',
498 'auto_shape_type' => 'AutoShapeType',
499 'placement' => 'Placement',
500 'upper_left_row' => 'UpperLeftRow',
501 'top' => 'Top',
502 'upper_left_column' => 'UpperLeftColumn',
503 'left' => 'Left',
504 'lower_right_row' => 'LowerRightRow',
505 'bottom' => 'Bottom',
506 'lower_right_column' => 'LowerRightColumn',
507 'right' => 'Right',
508 'width' => 'Width',
509 'height' => 'Height',
510 'x' => 'X',
511 'y' => 'Y',
512 'rotation_angle' => 'RotationAngle',
513 'html_text' => 'HtmlText',
514 'text' => 'Text',
515 'alternative_text' => 'AlternativeText',
516 'text_horizontal_alignment' => 'TextHorizontalAlignment',
517 'text_horizontal_overflow' => 'TextHorizontalOverflow',
518 'text_orientation_type' => 'TextOrientationType',
519 'text_vertical_alignment' => 'TextVerticalAlignment',
520 'text_vertical_overflow' => 'TextVerticalOverflow',
521 'is_group' => 'IsGroup',
522 'is_hidden' => 'IsHidden',
523 'is_lock_aspect_ratio' => 'IsLockAspectRatio',
524 'is_locked' => 'IsLocked',
525 'is_printable' => 'IsPrintable',
526 'is_text_wrapped' => 'IsTextWrapped',
527 'is_word_art' => 'IsWordArt',
528 'linked_cell' => 'LinkedCell',
529 'z_order_position' => 'ZOrderPosition',
530 'font' => 'Font',
531 'hyperlink' => 'Hyperlink',
532 'link' => 'link'
533 } );
534
535 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
536
537
538 1;