| 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::Button; | ||
| 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::Shape; | ||
| 41 | |||
| 42 | |||
| 43 | use base ("Class::Accessor", "Class::Data::Inheritable"); | ||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | __PACKAGE__->mk_classdata('attribute_map' => {}); | ||
| 48 | __PACKAGE__->mk_classdata('swagger_types' => {}); | ||
| 49 | __PACKAGE__->mk_classdata('method_documentation' => {}); | ||
| 50 | __PACKAGE__->mk_classdata('class_documentation' => {}); | ||
| 51 | |||
| 52 | # new object | ||
| 53 | sub new { | ||
| 54 | my ($class, %args) = @_; | ||
| 55 | |||
| 56 | my $self = bless {}, $class; | ||
| 57 | |||
| 58 | foreach my $attribute (keys %{$class->attribute_map}) { | ||
| 59 | my $args_key = $class->attribute_map->{$attribute}; | ||
| 60 | $self->$attribute( $args{ $args_key } ); | ||
| 61 | } | ||
| 62 | |||
| 63 | return $self; | ||
| 64 | } | ||
| 65 | |||
| 66 | # return perl hash | ||
| 67 | sub to_hash { | ||
| 68 | return decode_json(JSON->new->convert_blessed->encode( shift )); | ||
| 69 | } | ||
| 70 | |||
| 71 | # used by JSON for serialization | ||
| 72 | sub TO_JSON { | ||
| 73 | my $self = shift; | ||
| 74 | my $_data = {}; | ||
| 75 | foreach my $_key (keys %{$self->attribute_map}) { | ||
| 76 | if (defined $self->{$_key}) { | ||
| 77 | $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | return $_data; | ||
| 81 | } | ||
| 82 | |||
| 83 | # from Perl hashref | ||
| 84 | sub from_hash { | ||
| 85 | my ($self, $hash) = @_; | ||
| 86 | |||
| 87 | # loop through attributes and use swagger_types to deserialize the data | ||
| 88 | while ( my ($_key, $_type) = each %{$self->swagger_types} ) { | ||
| 89 | my $_json_attribute = $self->attribute_map->{$_key}; | ||
| 90 | if ($_type =~ /^array\[/i) { # array | ||
| 91 | my $_subclass = substr($_type, 6, -1); | ||
| 92 | my @_array = (); | ||
| 93 | foreach my $_element (@{$hash->{$_json_attribute}}) { | ||
| 94 | push @_array, $self->_deserialize($_subclass, $_element); | ||
| 95 | } | ||
| 96 | $self->{$_key} = \@_array; | ||
| 97 | } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime | ||
| 98 | $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); | ||
| 99 | } else { | ||
| 100 | $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); | ||
| 101 | } | ||
| 102 | } | ||
| 103 | |||
| 104 | return $self; | ||
| 105 | } | ||
| 106 | |||
| 107 | # deserialize non-array data | ||
| 108 | sub _deserialize { | ||
| 109 | my ($self, $type, $data) = @_; | ||
| 110 | $log->debugf("deserializing %s with %s",Dumper($data), $type); | ||
| 111 | |||
| 112 | if ($type eq 'DateTime') { | ||
| 113 | return DateTime->from_epoch(epoch => str2time($data)); | ||
| 114 | } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { | ||
| 115 | return $data; | ||
| 116 | } else { # hash(model) | ||
| 117 | my $_instance = eval "AsposeCellsCloud::Object::$type->new()"; | ||
| 118 | return $_instance->from_hash($data); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 | |||
| 123 | __PACKAGE__->class_documentation({description => 'Represents the Forms control: Button', | ||
| 124 | class => 'Button', | ||
| 125 | required => [], # TODO | ||
| 126 | } ); | ||
| 127 | |||
| 128 | |||
| 129 | __PACKAGE__->method_documentation({ | ||
| 130 | 'name' => { | ||
| 131 | datatype => 'string', | ||
| 132 | base_name => 'Name', | ||
| 133 | description => '', | ||
| 134 | format => '', | ||
| 135 | read_only => '', | ||
| 136 | }, | ||
| 137 | 'mso_drawing_type' => { | ||
| 138 | datatype => 'string', | ||
| 139 | base_name => 'MsoDrawingType', | ||
| 140 | description => '', | ||
| 141 | format => '', | ||
| 142 | read_only => '', | ||
| 143 | }, | ||
| 144 | 'auto_shape_type' => { | ||
| 145 | datatype => 'string', | ||
| 146 | base_name => 'AutoShapeType', | ||
| 147 | description => '', | ||
| 148 | format => '', | ||
| 149 | read_only => '', | ||
| 150 | }, | ||
| 151 | 'placement' => { | ||
| 152 | datatype => 'string', | ||
| 153 | base_name => 'Placement', | ||
| 154 | description => '', | ||
| 155 | format => '', | ||
| 156 | read_only => '', | ||
| 157 | }, | ||
| 158 | 'upper_left_row' => { | ||
| 159 | datatype => 'int', | ||
| 160 | base_name => 'UpperLeftRow', | ||
| 161 | description => '', | ||
| 162 | format => '', | ||
| 163 | read_only => '', | ||
| 164 | }, | ||
| 165 | 'top' => { | ||
| 166 | datatype => 'int', | ||
| 167 | base_name => 'Top', | ||
| 168 | description => '', | ||
| 169 | format => '', | ||
| 170 | read_only => '', | ||
| 171 | }, | ||
| 172 | 'upper_left_column' => { | ||
| 173 | datatype => 'int', | ||
| 174 | base_name => 'UpperLeftColumn', | ||
| 175 | description => '', | ||
| 176 | format => '', | ||
| 177 | read_only => '', | ||
| 178 | }, | ||
| 179 | 'left' => { | ||
| 180 | datatype => 'int', | ||
| 181 | base_name => 'Left', | ||
| 182 | description => '', | ||
| 183 | format => '', | ||
| 184 | read_only => '', | ||
| 185 | }, | ||
| 186 | 'lower_right_row' => { | ||
| 187 | datatype => 'int', | ||
| 188 | base_name => 'LowerRightRow', | ||
| 189 | description => '', | ||
| 190 | format => '', | ||
| 191 | read_only => '', | ||
| 192 | }, | ||
| 193 | 'bottom' => { | ||
| 194 | datatype => 'int', | ||
| 195 | base_name => 'Bottom', | ||
| 196 | description => '', | ||
| 197 | format => '', | ||
| 198 | read_only => '', | ||
| 199 | }, | ||
| 200 | 'lower_right_column' => { | ||
| 201 | datatype => 'int', | ||
| 202 | base_name => 'LowerRightColumn', | ||
| 203 | description => '', | ||
| 204 | format => '', | ||
| 205 | read_only => '', | ||
| 206 | }, | ||
| 207 | 'right' => { | ||
| 208 | datatype => 'int', | ||
| 209 | base_name => 'Right', | ||
| 210 | description => '', | ||
| 211 | format => '', | ||
| 212 | read_only => '', | ||
| 213 | }, | ||
| 214 | 'width' => { | ||
| 215 | datatype => 'int', | ||
| 216 | base_name => 'Width', | ||
| 217 | description => '', | ||
| 218 | format => '', | ||
| 219 | read_only => '', | ||
| 220 | }, | ||
| 221 | 'height' => { | ||
| 222 | datatype => 'int', | ||
| 223 | base_name => 'Height', | ||
| 224 | description => '', | ||
| 225 | format => '', | ||
| 226 | read_only => '', | ||
| 227 | }, | ||
| 228 | 'x' => { | ||
| 229 | datatype => 'int', | ||
| 230 | base_name => 'X', | ||
| 231 | description => '', | ||
| 232 | format => '', | ||
| 233 | read_only => '', | ||
| 234 | }, | ||
| 235 | 'y' => { | ||
| 236 | datatype => 'int', | ||
| 237 | base_name => 'Y', | ||
| 238 | description => '', | ||
| 239 | format => '', | ||
| 240 | read_only => '', | ||
| 241 | }, | ||
| 242 | 'rotation_angle' => { | ||
| 243 | datatype => 'double', | ||
| 244 | base_name => 'RotationAngle', | ||
| 245 | description => '', | ||
| 246 | format => '', | ||
| 247 | read_only => '', | ||
| 248 | }, | ||
| 249 | 'html_text' => { | ||
| 250 | datatype => 'string', | ||
| 251 | base_name => 'HtmlText', | ||
| 252 | description => '', | ||
| 253 | format => '', | ||
| 254 | read_only => '', | ||
| 255 | }, | ||
| 256 | 'text' => { | ||
| 257 | datatype => 'string', | ||
| 258 | base_name => 'Text', | ||
| 259 | description => '', | ||
| 260 | format => '', | ||
| 261 | read_only => '', | ||
| 262 | }, | ||
| 263 | 'alternative_text' => { | ||
| 264 | datatype => 'string', | ||
| 265 | base_name => 'AlternativeText', | ||
| 266 | description => '', | ||
| 267 | format => '', | ||
| 268 | read_only => '', | ||
| 269 | }, | ||
| 270 | 'text_horizontal_alignment' => { | ||
| 271 | datatype => 'string', | ||
| 272 | base_name => 'TextHorizontalAlignment', | ||
| 273 | description => '', | ||
| 274 | format => '', | ||
| 275 | read_only => '', | ||
| 276 | }, | ||
| 277 | 'text_horizontal_overflow' => { | ||
| 278 | datatype => 'string', | ||
| 279 | base_name => 'TextHorizontalOverflow', | ||
| 280 | description => '', | ||
| 281 | format => '', | ||
| 282 | read_only => '', | ||
| 283 | }, | ||
| 284 | 'text_orientation_type' => { | ||
| 285 | datatype => 'string', | ||
| 286 | base_name => 'TextOrientationType', | ||
| 287 | description => '', | ||
| 288 | format => '', | ||
| 289 | read_only => '', | ||
| 290 | }, | ||
| 291 | 'text_vertical_alignment' => { | ||
| 292 | datatype => 'string', | ||
| 293 | base_name => 'TextVerticalAlignment', | ||
| 294 | description => '', | ||
| 295 | format => '', | ||
| 296 | read_only => '', | ||
| 297 | }, | ||
| 298 | 'text_vertical_overflow' => { | ||
| 299 | datatype => 'string', | ||
| 300 | base_name => 'TextVerticalOverflow', | ||
| 301 | description => '', | ||
| 302 | format => '', | ||
| 303 | read_only => '', | ||
| 304 | }, | ||
| 305 | 'is_group' => { | ||
| 306 | datatype => 'boolean', | ||
| 307 | base_name => 'IsGroup', | ||
| 308 | description => '', | ||
| 309 | format => '', | ||
| 310 | read_only => '', | ||
| 311 | }, | ||
| 312 | 'is_hidden' => { | ||
| 313 | datatype => 'boolean', | ||
| 314 | base_name => 'IsHidden', | ||
| 315 | description => '', | ||
| 316 | format => '', | ||
| 317 | read_only => '', | ||
| 318 | }, | ||
| 319 | 'is_lock_aspect_ratio' => { | ||
| 320 | datatype => 'boolean', | ||
| 321 | base_name => 'IsLockAspectRatio', | ||
| 322 | description => '', | ||
| 323 | format => '', | ||
| 324 | read_only => '', | ||
| 325 | }, | ||
| 326 | 'is_locked' => { | ||
| 327 | datatype => 'boolean', | ||
| 328 | base_name => 'IsLocked', | ||
| 329 | description => '', | ||
| 330 | format => '', | ||
| 331 | read_only => '', | ||
| 332 | }, | ||
| 333 | 'is_printable' => { | ||
| 334 | datatype => 'boolean', | ||
| 335 | base_name => 'IsPrintable', | ||
| 336 | description => '', | ||
| 337 | format => '', | ||
| 338 | read_only => '', | ||
| 339 | }, | ||
| 340 | 'is_text_wrapped' => { | ||
| 341 | datatype => 'boolean', | ||
| 342 | base_name => 'IsTextWrapped', | ||
| 343 | description => '', | ||
| 344 | format => '', | ||
| 345 | read_only => '', | ||
| 346 | }, | ||
| 347 | 'is_word_art' => { | ||
| 348 | datatype => 'boolean', | ||
| 349 | base_name => 'IsWordArt', | ||
| 350 | description => '', | ||
| 351 | format => '', | ||
| 352 | read_only => '', | ||
| 353 | }, | ||
| 354 | 'linked_cell' => { | ||
| 355 | datatype => 'string', | ||
| 356 | base_name => 'LinkedCell', | ||
| 357 | description => '', | ||
| 358 | format => '', | ||
| 359 | read_only => '', | ||
| 360 | }, | ||
| 361 | 'z_order_position' => { | ||
| 362 | datatype => 'int', | ||
| 363 | base_name => 'ZOrderPosition', | ||
| 364 | description => '', | ||
| 365 | format => '', | ||
| 366 | read_only => '', | ||
| 367 | }, | ||
| 368 | 'font' => { | ||
| 369 | datatype => 'Font', | ||
| 370 | base_name => 'Font', | ||
| 371 | description => '', | ||
| 372 | format => '', | ||
| 373 | read_only => '', | ||
| 374 | }, | ||
| 375 | 'hyperlink' => { | ||
| 376 | datatype => 'string', | ||
| 377 | base_name => 'Hyperlink', | ||
| 378 | description => '', | ||
| 379 | format => '', | ||
| 380 | read_only => '', | ||
| 381 | }, | ||
| 382 | 'link' => { | ||
| 383 | datatype => 'Link', | ||
| 384 | base_name => 'link', | ||
| 385 | description => '', | ||
| 386 | format => '', | ||
| 387 | read_only => '', | ||
| 388 | }, | ||
| 389 | }); | ||
| 390 | |||
| 391 | __PACKAGE__->swagger_types( { | ||
| 392 | 'name' => 'string', | ||
| 393 | 'mso_drawing_type' => 'string', | ||
| 394 | 'auto_shape_type' => 'string', | ||
| 395 | 'placement' => 'string', | ||
| 396 | 'upper_left_row' => 'int', | ||
| 397 | 'top' => 'int', | ||
| 398 | 'upper_left_column' => 'int', | ||
| 399 | 'left' => 'int', | ||
| 400 | 'lower_right_row' => 'int', | ||
| 401 | 'bottom' => 'int', | ||
| 402 | 'lower_right_column' => 'int', | ||
| 403 | 'right' => 'int', | ||
| 404 | 'width' => 'int', | ||
| 405 | 'height' => 'int', | ||
| 406 | 'x' => 'int', | ||
| 407 | 'y' => 'int', | ||
| 408 | 'rotation_angle' => 'double', | ||
| 409 | 'html_text' => 'string', | ||
| 410 | 'text' => 'string', | ||
| 411 | 'alternative_text' => 'string', | ||
| 412 | 'text_horizontal_alignment' => 'string', | ||
| 413 | 'text_horizontal_overflow' => 'string', | ||
| 414 | 'text_orientation_type' => 'string', | ||
| 415 | 'text_vertical_alignment' => 'string', | ||
| 416 | 'text_vertical_overflow' => 'string', | ||
| 417 | 'is_group' => 'boolean', | ||
| 418 | 'is_hidden' => 'boolean', | ||
| 419 | 'is_lock_aspect_ratio' => 'boolean', | ||
| 420 | 'is_locked' => 'boolean', | ||
| 421 | 'is_printable' => 'boolean', | ||
| 422 | 'is_text_wrapped' => 'boolean', | ||
| 423 | 'is_word_art' => 'boolean', | ||
| 424 | 'linked_cell' => 'string', | ||
| 425 | 'z_order_position' => 'int', | ||
| 426 | 'font' => 'Font', | ||
| 427 | 'hyperlink' => 'string', | ||
| 428 | 'link' => 'Link' | ||
| 429 | } ); | ||
| 430 | |||
| 431 | __PACKAGE__->attribute_map( { | ||
| 432 | 'name' => 'Name', | ||
| 433 | 'mso_drawing_type' => 'MsoDrawingType', | ||
| 434 | 'auto_shape_type' => 'AutoShapeType', | ||
| 435 | 'placement' => 'Placement', | ||
| 436 | 'upper_left_row' => 'UpperLeftRow', | ||
| 437 | 'top' => 'Top', | ||
| 438 | 'upper_left_column' => 'UpperLeftColumn', | ||
| 439 | 'left' => 'Left', | ||
| 440 | 'lower_right_row' => 'LowerRightRow', | ||
| 441 | 'bottom' => 'Bottom', | ||
| 442 | 'lower_right_column' => 'LowerRightColumn', | ||
| 443 | 'right' => 'Right', | ||
| 444 | 'width' => 'Width', | ||
| 445 | 'height' => 'Height', | ||
| 446 | 'x' => 'X', | ||
| 447 | 'y' => 'Y', | ||
| 448 | 'rotation_angle' => 'RotationAngle', | ||
| 449 | 'html_text' => 'HtmlText', | ||
| 450 | 'text' => 'Text', | ||
| 451 | 'alternative_text' => 'AlternativeText', | ||
| 452 | 'text_horizontal_alignment' => 'TextHorizontalAlignment', | ||
| 453 | 'text_horizontal_overflow' => 'TextHorizontalOverflow', | ||
| 454 | 'text_orientation_type' => 'TextOrientationType', | ||
| 455 | 'text_vertical_alignment' => 'TextVerticalAlignment', | ||
| 456 | 'text_vertical_overflow' => 'TextVerticalOverflow', | ||
| 457 | 'is_group' => 'IsGroup', | ||
| 458 | 'is_hidden' => 'IsHidden', | ||
| 459 | 'is_lock_aspect_ratio' => 'IsLockAspectRatio', | ||
| 460 | 'is_locked' => 'IsLocked', | ||
| 461 | 'is_printable' => 'IsPrintable', | ||
| 462 | 'is_text_wrapped' => 'IsTextWrapped', | ||
| 463 | 'is_word_art' => 'IsWordArt', | ||
| 464 | 'linked_cell' => 'LinkedCell', | ||
| 465 | 'z_order_position' => 'ZOrderPosition', | ||
| 466 | 'font' => 'Font', | ||
| 467 | 'hyperlink' => 'Hyperlink', | ||
| 468 | 'link' => 'link' | ||
| 469 | } ); | ||
| 470 | |||
| 471 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 472 | |||
| 473 | |||
| 474 | 1; |