| 1 | package Excel::Template::Element::Cell; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | BEGIN { | ||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | @ISA = qw(Excel::Template::Element); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Excel::Template::Element; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | sub new | ||||||||||||||||||||||||||||
| 13 | { | ||||||||||||||||||||||||||||
| 14 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 0 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | $self->{TXTOBJ} = Excel::Template::Factory->_create('TEXTOBJECT'); | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | return $self; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | sub _get_text | ||||||||||||||||||||||||||||
| 23 | { | ||||||||||||||||||||||||||||
| 24 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_get_text: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 25 | 0 | my ($context) = @_; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | my $txt = $context->get($self, 'TEXT'); | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | if (defined $txt) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||
| 30 | 0 | my $txt_obj = Excel::Template::Factory->_create('TEXTOBJECT'); | |||||||||||||||||||||||||||
| 31 | 0 | push @{$txt_obj->{STACK}}, $txt; | |||||||||||||||||||||||||||
| 32 | 0 | $txt = $txt_obj->resolve($context); | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | else | ||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||
| 36 | 0 | $txt = $self->{TXTOBJ}->resolve($context) | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | return $txt; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | my %legal_types = ( | |||||||||||||||||||||||||||
| 43 | 'blank' => 'write_blank', | ||||||||||||||||||||||||||||
| 44 | 'formula' => 'write_formula', | ||||||||||||||||||||||||||||
| 45 | 'number' => 'write_number', | ||||||||||||||||||||||||||||
| 46 | 'string' => 'write_string', | ||||||||||||||||||||||||||||
| 47 | 'url' => 'write_url', | ||||||||||||||||||||||||||||
| 48 | 'date_time' => 'write_date_time', | ||||||||||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | sub render | ||||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
render: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 54 | 0 | my ($context, $method) = @_; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | unless ( $method ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||
| 58 | 0 | my $type = $context->get( $self, 'TYPE' ); | |||||||||||||||||||||||||||
| 59 | 0 | ▶ | if ( defined $type ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||
| 61 | 0 | my $type = lc $type; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | if ( exists $legal_types{ $type } ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | { | ||||||||||||||||||||||||||||
| 65 | 0 | $method = $legal_types{ $type }; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | else | ||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | warn "'$type' is not a legal cell type.\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | if $^W; | ||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $method ||= 'write'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$method ||= "write"
MC/DC0%0/1
$method ||= "write"
$method
Truth table0%0/2
A
A= $method
| |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | my ($row, $col) = map { $context->get($self, $_) } qw(ROW COL); | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | my $ref = $context->get( $self, 'REF' ); | |||||||||||||||||||||||||||
| 80 | 0 | ▶ | if (defined $ref && length $ref) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ref and length $ref
MC/DC0%0/2
defined $ref and length $ref
defined $ref
length $ref
Truth table0%0/3
A and B
A= defined $refB= length $ref
| |||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||
| 82 | 0 | $context->add_reference( uc( $ref ), $row, $col ); | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | # Apply the cell width to the current column | ||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if (my $width = $context->get($self, 'WIDTH')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||
| 88 | 0 | $width =~ s/[^\d.]//g; | |||||||||||||||||||||||||||
| 89 | 0 | $width *= 1; | |||||||||||||||||||||||||||
| 90 | 0 | ▶ | if ($width > 0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||
| 92 | 0 | $context->active_worksheet->set_column($col, $col, $width); | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | $context->active_worksheet->$method( | |||||||||||||||||||||||||||
| 97 | $row, $col, | ||||||||||||||||||||||||||||
| 98 | $self->_get_text($context), | ||||||||||||||||||||||||||||
| 99 | $context->active_format, | ||||||||||||||||||||||||||||
| 100 | ); | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | return 1; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | sub deltas | ||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||
| 107 | return { | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | COL => +1, | ||||||||||||||||||||||||||
|
Subroutine
deltas: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | }; | ||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 1 | 1; | |||||||||||||||||||||||||||
| 113 | __END__ | ||||||||||||||||||||||||||||