| 1 | package Spreadsheet::Reader::ExcelXML::XMLReader::FileWorksheet; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 17 | our $AUTHORITY = 'cpan:JANDREW'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 17 | ▶ | use version; our $VERSION = version->declare('v0.16.8'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ###LogSD warn "You uncovered internal logging statements for Spreadsheet::Reader::ExcelXML::XMLReader::FileWorksheet-$VERSION"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 17 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 17 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 17 | requires qw( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | current_named_node current_node_parsed starts_at_the_edge | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | _parse_column_row advance_element_position good_load | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | start_the_file_over squash_node parse_element | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | spreading_merged_values should_skip_hidden has_shared_strings_interface | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | get_shared_string are_spaces_empty get_empty_return_type | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | get_values_only collecting_merge_data collecting_column_formats | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 17 | ▶ | use Clone 'clone'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 17 | ▶ | use Carp qw( confess ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 17 | ▶ | use Types::Standard qw( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | Bool Int is_HashRef ArrayRef | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | Maybe HashRef | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 17 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 17 | ▶ | use MooseX::ShortCut::BuildInstance qw ( build_instance should_re_use_classes ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 17 | should_re_use_classes( 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 17 | ▶ | use lib '../../../../lib'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ###LogSD use Log::Shiras::Telephone; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | #########1 Dispatch Tables & Package Variables 5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | #########1 Public Attributes 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 17 | has is_hidden =>( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | isa => Bool, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | reader => 'is_sheet_hidden', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | #########1 Public Methods 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 207 | ▶ | sub advance_row_position{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
advance_row_position: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 207 | my( $self, $increment ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 207 | ▶ | $increment //= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$increment //= 1
MC/DC100%1/1
$increment //= 1
$increment
Truth table100%2/2
A
A= $increment
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ###LogSD $self->get_all_space . '::FileWorksheet::advance_row_position', ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ###LogSD "Moving row forward -$increment- times", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 207 | my( $result, $node_name, $node_level ) = $self->advance_element_position( 'row', $increment ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ###LogSD $phone->talk( level => 'debug ', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ###LogSD "advance result is:" . ($result//'fail') ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 207 | ▶ | return undef if !$result; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # Pull data about the row | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 193 | my $row_ref = $self->current_node_parsed; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 193 | $row_ref = $row_ref->{row}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 193 | delete $row_ref->{raw_text}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 193 | $self->_set_custom_row_data( $row_ref->{r} => $row_ref );# Should this be tied into cache_positions? | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ###LogSD $phone->talk( level => 'debug ', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ###LogSD "parse result is:", $row_ref, $self->_get_all_positions, ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 193 | return $row_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 193 | ▶ | sub build_row_data{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_row_data: called CC=75 SCAR=44.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 193 | my( $self, ) = @_;# $row_ref, $row_position | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ###LogSD $self->get_all_space . '::FileWorksheet::build_row_data', ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ###LogSD "Building out the current row node", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 193 | my $full_row_ref = $self->squash_node( $self->parse_element ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ###LogSD $phone->talk( level => 'trace', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ###LogSD "Full row parsed to:", $full_row_ref, ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # Confirm row list | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 193 | ▶ | if( exists $full_row_ref->{c} ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 47 | my $alt_row->{list} = [ $full_row_ref->{c} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 47 | delete $full_row_ref->{c}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 47 | $alt_row->{attributes} = $full_row_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 47 | $full_row_ref = $alt_row; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ###LogSD $phone->talk( level => 'trace', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ###LogSD "New full row adjusted to:", $full_row_ref, ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 193 | my $new_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | @$new_ref{qw( row_number row_formats )} = exists $full_row_ref->{attributes} ? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ( $full_row_ref->{attributes}->{r}, $full_row_ref->{attributes} ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 193 | ▶ | ( $full_row_ref->{r}, $full_row_ref ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ###LogSD $phone->talk( level => 'trace', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ###LogSD "updated Full row:", $full_row_ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ###LogSD "New row ref initialized as:", $new_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # set spans value | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 193 | ▶ | if( exists $full_row_ref->{attributes}->{spans} ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | $new_ref->{row_span} = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 187 | [ $full_row_ref->{attributes}->{spans} =~ /(\d+):(\d+)/ ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 6 | ▶ | $new_ref->{row_span} = [($self->_min_col//1),($self->_max_col//1)]; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$self->_min_col // 1
$self->_max_col // 1
MC/DC0%0/1
$self->_min_col // 1
$self->_min_col
MC/DC100%1/1
$self->_max_col // 1
$self->_max_col
Truth table50%1/2
A
A= $self->_min_col
Truth table100%2/2
A
A= $self->_max_col
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ###LogSD $phone->talk( level => 'trace', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | ###LogSD "Updated new ref:", $new_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # Parse the cells for position and range | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 193 | my $column_to_cell_translations = []; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 193 | my $last_value_column; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | my $alt_ref; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 193 | for my $cell ( @{$full_row_ref->{list}} ){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ###LogSD "Processing cell:", $cell] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 499 | @$cell{qw( cell_col cell_row )} = $self->_parse_column_row( $cell->{r} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ###LogSD "Cell column: $cell->{cell_col}", "Cell row: $cell->{cell_row}" ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # load cell_type, cell_xml_value, and rich text | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # can't delay this because the information is required for 'empty_is_end' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 499 | $cell->{cell_type} = 'Text'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 499 | my $v_node = $cell->{v}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | ###LogSD "v node is:", $v_node ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 499 | ▶ | if( exists $cell->{t} ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 189 | ▶ | if( $cell->{t} eq 's' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | ###LogSD "Identified potentially required shared string for cell:", $cell] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 174 | ▶ | my $position = ( $self->has_shared_strings_interface ) ? | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | $self->get_shared_string( $v_node ) : $v_node; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ###LogSD "Shared strings resolved to:", $position] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 174 | ▶ | if( is_HashRef( $position ) ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 79 | @$cell{qw( cell_xml_value rich_text )} = ( $position->{raw_text}, $position->{rich_text} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 79 | ▶ | delete $cell->{rich_text} if !$cell->{rich_text}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 95 | $cell->{cell_xml_value} = $position; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | }elsif( $cell->{t} =~ /^(e|inlineStr)$/ ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ###LogSD "Identified a stored string in the worksheet file: ", $v_node ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 3 | $cell->{cell_xml_value} = $v_node; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | }elsif( $cell->{t} eq 'str' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ###LogSD "Identified a potential formula stored in the core data position: ", $v_node ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 11 | $cell->{cell_xml_value} = $v_node; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 11 | ▶ | if( !exists $cell->{f} and $v_node =~ /\=/ ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not exists $cell->{"f"} and $v_node =~ /\=/
MC/DC0%0/2
not exists $cell->{"f"} and $v_node =~ /\=/
not exists $cell->{"f"}
$v_node =~ /\=/
Truth table33%1/3
not(A) and B
A= not exists $cell->{"f"}B= $v_node =~ /\=/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $cell->{f} = $v_node; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | }elsif( $cell->{t} eq 'b' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | ###LogSD "Identified a stored boolean in the worksheet file: ", $v_node ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | ▶ | $cell->{cell_xml_value} = $v_node ? 1 : 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | $cell->{cell_type} = 'Numeric'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | }elsif( $cell->{t} eq 'd' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ###LogSD "Identified a stored date in the worksheet file: ", $v_node ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $cell->{cell_xml_value} = $v_node; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $cell->{cell_type} = 'Date'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | }elsif( $cell->{t} eq 'n' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | ###LogSD "Identified a stored number in the worksheet file: ", $v_node ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $cell->{cell_xml_value} = $v_node; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $cell->{cell_type} = 'Numeric'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | confess "Unknown 't' attribute set for the cell: $cell->{t}"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 189 | delete $cell->{t}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 189 | ▶ | if( $self->are_spaces_empty and $cell->{cell_xml_value} and $cell->{cell_xml_value} =~ /^\s+$/ ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->are_spaces_empty and $cell->{"cell_xml_value"} and $cell->{"cell_xml_value"} =~ /^\s+$/
$self->are_spaces_empty and $cell->{"cell_xml_value"}
MC/DC100%3/3
$self->are_spaces_empty and $cell->{"cell_xml_value"} and $cell->{"cell_xml_value"} =~ /^\s+$/
$self->are_spaces_empty
$cell->{"cell_xml_value"}
$cell->{"cell_xml_value"} =~ /^\s+$/
Truth table100%4/4
A and B and C
A= $self->are_spaces_emptyB= $cell->{"cell_xml_value"}C= $cell->{"cell_xml_value"} =~ /^\s+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | ###LogSD "Clearing spaces only xml value: " . ($v_node//'')] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 8 | delete $cell->{cell_xml_value}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | }elsif( defined $v_node ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ###LogSD "Setting cell_xml_value from: $v_node", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 272 | $cell->{cell_xml_value} = $v_node; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 272 | ▶ | $cell->{cell_type} = 'Numeric' if $cell->{cell_xml_value} and $cell->{cell_xml_value} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$cell->{"cell_xml_value"} and $cell->{"cell_xml_value"} ne ""
MC/DC50%1/2
$cell->{"cell_xml_value"} and $cell->{"cell_xml_value"} ne ""
$cell->{"cell_xml_value"}
$cell->{"cell_xml_value"} ne ""
Truth table66%2/3
A and B
A= $cell->{"cell_xml_value"}B= $cell->{"cell_xml_value"} ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 499 | delete $cell->{v}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 499 | ▶ | if( $self->get_empty_return_type eq 'empty_string' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 220 | ▶ | $cell->{cell_xml_value} = '' if !exists $cell->{cell_xml_value} or !defined $cell->{cell_xml_value}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $cell->{"cell_xml_value"} and defined $cell->{"cell_xml_value"}
MC/DC100%2/2
exists $cell->{"cell_xml_value"} and defined $cell->{"cell_xml_value"}
exists $cell->{"cell_xml_value"}
defined $cell->{"cell_xml_value"}
Truth table100%3/3
A and B
A= exists $cell->{"cell_xml_value"}B= defined $cell->{"cell_xml_value"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | ▶ | }elsif( !defined $cell->{cell_xml_value} or | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
not defined $cell->{"cell_xml_value"} or $cell->{"cell_xml_value"} and length $cell->{"cell_xml_value"} == 0
$cell->{"cell_xml_value"} and length $cell->{"cell_xml_value"} == 0
MC/DC33%1/3
not defined $cell->{"cell_xml_value"} or $cell->{"cell_xml_value"} and length $cell->{"cell_xml_value"} == 0
not defined $cell->{"cell_xml_value"}
$cell->{"cell_xml_value"}
length $cell->{"cell_xml_value"} == 0
Truth table75%3/4
not(A) or B and C
A= not defined $cell->{"cell_xml_value"}B= $cell->{"cell_xml_value"}C= length $cell->{"cell_xml_value"} == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | ($cell->{cell_xml_value} and length( $cell->{cell_xml_value} ) == 0) ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 41 | delete $cell->{cell_xml_value}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | ###LogSD "Updated cell:", $cell] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # Handle formula, position translations, and last value | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 499 | ▶ | $cell->{cell_formula} = $cell->{f} if exists $cell->{f}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 499 | delete $cell->{f}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 499 | $last_value_column = $cell->{cell_col}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 499 | push @$alt_ref, $cell; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 499 | $column_to_cell_translations->[$cell->{cell_col}] = $#$alt_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ###LogSD 'Saving cell:', $cell, $alt_ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ###LogSD "..with column to cell translations:", $column_to_cell_translations, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | ###LogSD "..and last value column: $last_value_column", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # Scrub merge cells, column formats, and then empty values | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | my $max_column = ( $last_value_column and $new_ref->{row_span}->[1] < $last_value_column) ? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 193 | ▶ | $last_value_column : $new_ref->{row_span}->[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$last_value_column and $new_ref->{"row_span"}[1] < $last_value_column
MC/DC50%1/2
$last_value_column and $new_ref->{"row_span"}[1] < $last_value_column
$last_value_column
$new_ref->{"row_span"}[1] < $last_value_column
Truth table66%2/3
A and B
A= $last_value_columnB= $new_ref->{"row_span"}[1] < $last_value_column
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 193 | my( $cell_stack, $position_stack ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ###LogSD "Asking for row merge map of:", $new_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 193 | my $merge_range = $self->_get_row_merge_map( $new_ref->{row_number} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ###LogSD "Full row merge settings:", $merge_range ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 193 | SCRUBINGCELLSTACK: for my $col ( 1 .. $max_column ){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | ###LogSD "Processing column: $col", , | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | ###LogSD (defined $column_to_cell_translations->[$col] ? $alt_ref->[$column_to_cell_translations->[$col]] : undef) ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 902 | my $new_cell; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # Resolve additional merge info | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 902 | ▶ | if( $merge_range and $merge_range->[$col] ){# Do it different for named worksheets | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$merge_range and $merge_range->[$col]
MC/DC100%2/2
$merge_range and $merge_range->[$col]
$merge_range
$merge_range->[$col]
Truth table100%3/3
A and B
A= $merge_rangeB= $merge_range->[$col]
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ###LogSD "Column -$col- is part of a merge range", $new_cell->{cell_merge} ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # Handle primary position sharing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 34 | ▶ | if( $self->spreading_merged_values ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 4 | my $not_primary = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 4 | ▶ | if( defined $column_to_cell_translations->[$col] and $alt_ref->[$column_to_cell_translations->[$col]] ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $column_to_cell_translations->[$col] and $$alt_ref[$column_to_cell_translations->[$col]]
MC/DC0%0/2
defined $column_to_cell_translations->[$col] and $$alt_ref[$column_to_cell_translations->[$col]]
defined $column_to_cell_translations->[$col]
$$alt_ref[$column_to_cell_translations->[$col]]
Truth table33%1/3
A and B
A= defined $column_to_cell_translations->[$col]B= $$alt_ref[$column_to_cell_translations->[$col]]
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | ###LogSD "Checking column -$col- to see if it contains the primary value" ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 4 | $merge_range->[$col] =~ /([^:]+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 4 | ▶ | if( $alt_ref->[$column_to_cell_translations->[$col]]->{r} eq $1 ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | $not_primary = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | ###LogSD "Found a primary value at: " . $alt_ref->[$column_to_cell_translations->[$col]]->{r} ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | my $primary_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 2 | for my $key ( qw( rich_text cell_xml_value s cell_type ) ){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 8 | ▶ | if( !exists $primary_ref->{$key} and | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not exists $primary_ref->{$key} and exists $$alt_ref[$column_to_cell_translations->[$col]]{$key}
MC/DC50%1/2
not exists $primary_ref->{$key} and exists $$alt_ref[$column_to_cell_translations->[$col]]{$key}
not exists $primary_ref->{$key}
exists $$alt_ref[$column_to_cell_translations->[$col]]{$key}
Truth table66%2/3
not(A) and B
A= not exists $primary_ref->{$key}B= exists $$alt_ref[$column_to_cell_translations->[$col]]{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | exists $alt_ref->[$column_to_cell_translations->[$col]]->{$key} ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 7 | $primary_ref->{$key} = $alt_ref->[$column_to_cell_translations->[$col]]->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | ###LogSD "primary ref is:", $primary_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 2 | ▶ | delete $primary_ref->{rich_text} if !$primary_ref->{rich_text}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | ###LogSD "Built primary ref: ", $primary_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 2 | $self->_set_merged_value( $merge_range->[$col] => $primary_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 4 | ▶ | if( $not_primary ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | $new_cell = $self->_get_merged_value( $merge_range->[$col] ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | ###LogSD "New cell now has: ", $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 34 | $new_cell->{cell_merge} = $merge_range->[$col]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | ###LogSD "updated new cell now has: ", $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # Handle formats (especially from the column) including hidden - more work needed here! | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 902 | ▶ | if( $new_cell or (defined $column_to_cell_translations->[$col] and | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$new_cell or defined $column_to_cell_translations->[$col] and $$alt_ref[$column_to_cell_translations->[$col]]
defined $column_to_cell_translations->[$col] and $$alt_ref[$column_to_cell_translations->[$col]]
MC/DC66%2/3
$new_cell or defined $column_to_cell_translations->[$col] and $$alt_ref[$column_to_cell_translations->[$col]]
$new_cell
defined $column_to_cell_translations->[$col]
$$alt_ref[$column_to_cell_translations->[$col]]
Truth table75%3/4
A or B and C
A= $new_cellB= defined $column_to_cell_translations->[$col]C= $$alt_ref[$column_to_cell_translations->[$col]]
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | $alt_ref->[$column_to_cell_translations->[$col]] ) ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | $new_cell->{cell_hidden} = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | $self->is_sheet_hidden ? 'sheet' : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ( $self->get_custom_column_data( $col ) and | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | exists $self->get_custom_column_data( $col )->{hidden} and | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | $self->get_custom_column_data( $col )->{hidden} ) ? 'column' : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 499 | ▶ | $full_row_ref->{attributes}->{hidden} ? 'row' : undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition83%5/6
$self->get_custom_column_data($col) and exists $self->get_custom_column_data($col)->{"hidden"} and $self->get_custom_column_data($col)->{"hidden"}
$self->get_custom_column_data($col) and exists $self->get_custom_column_data($col)->{"hidden"}
MC/DC66%2/3
$self->get_custom_column_data($col) and exists $self->get_custom_column_data($col)->{"hidden"} and $self->get_custom_column_data($col)->{"hidden"}
$self->get_custom_column_data($col)
exists $self->get_custom_column_data($col)->{"hidden"}
$self->get_custom_column_data($col)->{"hidden"}
Truth table75%3/4
A and B and C
A= $self->get_custom_column_data($col)B= exists $self->get_custom_column_data($col)->{"hidden"}C= $self->get_custom_column_data($col)->{"hidden"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 499 | ▶ | delete $new_cell->{cell_hidden} if !$new_cell->{cell_hidden}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | ###LogSD "updated new cell now has: ", $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # Load in remaining data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | ###LogSD "Possibly loading additional cell data: ", defined $column_to_cell_translations->[$col] ? $alt_ref->[$column_to_cell_translations->[$col]] : $column_to_cell_translations->[$col] ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 902 | ▶ | if( defined $column_to_cell_translations->[$col] and $alt_ref->[$column_to_cell_translations->[$col]] ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $column_to_cell_translations->[$col] and $$alt_ref[$column_to_cell_translations->[$col]]
MC/DC50%1/2
defined $column_to_cell_translations->[$col] and $$alt_ref[$column_to_cell_translations->[$col]]
defined $column_to_cell_translations->[$col]
$$alt_ref[$column_to_cell_translations->[$col]]
Truth table66%2/3
A and B
A= defined $column_to_cell_translations->[$col]B= $$alt_ref[$column_to_cell_translations->[$col]]
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | ###LogSD "Mapping file column -$col- from position: $column_to_cell_translations->[$col]", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 499 | ▶ | map{ $new_cell->{$_} = $alt_ref->[$column_to_cell_translations->[$col]]->{$_} if !exists $new_cell->{$_} } keys %{$alt_ref->[$column_to_cell_translations->[$col]]}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | ###LogSD "Updated new cell:", $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | # Skip hidden | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | ###LogSD "Should skip hidden: " . $self->should_skip_hidden, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ###LogSD "With hidden value exists: " . (($new_cell and exists $new_cell->{ cell_hidden }) ? $new_cell->{ cell_hidden } : 'undef'), $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 902 | ▶ | if( $self->should_skip_hidden and $new_cell and exists $new_cell->{cell_hidden} ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->should_skip_hidden and $new_cell and exists $new_cell->{"cell_hidden"}
$self->should_skip_hidden and $new_cell
MC/DC100%3/3
$self->should_skip_hidden and $new_cell and exists $new_cell->{"cell_hidden"}
$self->should_skip_hidden
$new_cell
exists $new_cell->{"cell_hidden"}
Truth table100%4/4
A and B and C
A= $self->should_skip_hiddenB= $new_cellC= exists $new_cell->{"cell_hidden"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | ###LogSD "Skipping a known hidden cell", $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 15 | next SCRUBINGCELLSTACK; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # Skip empty | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | ###LogSD "Checking values only: " . $self->get_values_only, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | ###LogSD "With xml value exists: " . exists $new_cell->{cell_xml_value}, $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 887 | ▶ | if( $self->get_values_only and $new_cell and !exists $new_cell->{cell_xml_value} ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->get_values_only and $new_cell and not exists $new_cell->{"cell_xml_value"}
$self->get_values_only and $new_cell
MC/DC100%3/3
$self->get_values_only and $new_cell and not exists $new_cell->{"cell_xml_value"}
$self->get_values_only
$new_cell
not exists $new_cell->{"cell_xml_value"}
Truth table100%4/4
A and B and not(C)
A= $self->get_values_onlyB= $new_cellC= not exists $new_cell->{"cell_xml_value"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | ###LogSD "Skipping the empty cell", $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 4 | next SCRUBINGCELLSTACK; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # Stack new data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | ###LogSD "Checking if anything was stored in new_cell:", $new_cell ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 883 | ▶ | if( $new_cell and (keys %$new_cell ) > 0 ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$new_cell and keys %$new_cell > 0
MC/DC50%1/2
$new_cell and keys %$new_cell > 0
$new_cell
keys %$new_cell > 0
Truth table66%2/3
A and B
A= $new_cellB= keys %$new_cell > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 480 | push @$cell_stack, $new_cell; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 480 | $position_stack->[$new_cell->{cell_col}] = $#$cell_stack; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ###LogSD 'Updated cell stack:', $cell_stack, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | ###LogSD '..with position stack:', $position_stack ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 480 | $last_value_column = $new_cell->{cell_col}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 193 | $new_ref->{column_to_cell_translations} = $position_stack; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # Handle full empty rows here | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | ###LogSD 'Updated cell stack:', $cell_stack, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | ###LogSD '..with position stack:', $position_stack, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ###LogSD '..and last value column:', $last_value_column ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 193 | ▶ | if( $cell_stack ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 186 | $new_ref->{row_value_cells} = $cell_stack; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # Update max column as needed | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 186 | $new_ref->{row_last_value_column} = $last_value_column; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 186 | ▶ | if( !$self->has_max_col or $last_value_column > $self->_max_col ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $self->has_max_col or $last_value_column > $self->_max_col
MC/DC50%1/2
not $self->has_max_col or $last_value_column > $self->_max_col
not $self->has_max_col
$last_value_column > $self->_max_col
Truth table66%2/3
not(A) or B
A= not $self->has_max_colB= $last_value_column > $self->_max_col
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | ###LogSD "Updating max column with: $last_value_column", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 6 | $self->_set_max_col( $last_value_column ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # Update span end | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 186 | ▶ | if( $new_ref->{row_span}->[1] < $last_value_column ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | ###LogSD "Updating span-end with: $last_value_column", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 2 | $new_ref->{row_span}->[1] = $last_value_column; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # Update max row | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 186 | ▶ | if( !$self->has_max_row or $new_ref->{row_number} > $self->_max_row ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $self->has_max_row or $new_ref->{"row_number"} > $self->_max_row
MC/DC100%2/2
not $self->has_max_row or $new_ref->{"row_number"} > $self->_max_row
not $self->has_max_row
$new_ref->{"row_number"} > $self->_max_row
Truth table100%3/3
not(A) or B
A= not $self->has_max_rowB= $new_ref->{"row_number"} > $self->_max_row
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | ###LogSD "Updating max row with: $new_ref->{row_number}", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 26 | $self->_set_max_row( $new_ref->{row_number} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # Update max column | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 186 | ▶ | if( !$self->has_max_col or $new_ref->{row_span}->[1] > $self->_max_col ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $self->has_max_col or $new_ref->{"row_span"}[1] > $self->_max_col
MC/DC50%1/2
not $self->has_max_col or $new_ref->{"row_span"}[1] > $self->_max_col
not $self->has_max_col
$new_ref->{"row_span"}[1] > $self->_max_col
Truth table66%2/3
not(A) or B
A= not $self->has_max_colB= $new_ref->{"row_span"}[1] > $self->_max_col
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | ###LogSD "Updating max column with: $new_ref->{row_span}->[1]", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 3 | $self->_set_max_col( $new_ref->{row_span}->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | ###LogSD 'No data available for this row', ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 7 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | ###LogSD $phone->talk( level => 'trace', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | ###LogSD "Updated new ref:", $new_ref,] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 186 | return $new_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 30 | ▶ | sub load_unique_bits{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_unique_bits: called CC=22 SCAR=31.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 30 | my( $self, ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | ###LogSD my $phone = Log::Shiras::Telephone->new( name_space => | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | ###LogSD $self->get_all_space . '::FileWorksheet::load_unique_bits', ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | ###LogSD "Setting the Worksheet unique bits", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # Read the sheet row-column dimensions | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 30 | my $good_load = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 30 | my $current_named_node = $self->current_named_node; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | ###LogSD "Currently at named node:", $current_named_node, ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 30 | my $result = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 30 | my( $node_name, $node_level, $node_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 30 | ▶ | if( $current_named_node->{name} eq 'dimension' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ###LogSD "already at the dimension node" ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 30 | ( $result, $node_name ) = $self->advance_element_position( 'dimension' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | ###LogSD "attempt to get to the dimension node result: $result" ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 30 | ▶ | if( $result ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 30 | my $dimension = $self->current_node_parsed; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | ###LogSD "parsed dimension value:", $dimension ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 30 | my ( $start, $end ) = split( /:/, $dimension->{dimension}->{ref} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | ###LogSD "Start position: $start", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | ###LogSD ( $end ? "End position: $end" : '' ), ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 30 | ▶ | my ( $start_column, $start_row ) = ( $self->starts_at_the_edge ) ? | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | ( 1, 1 ) : $self->_parse_column_row( $start ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 30 | ▶ | my ( $end_column, $end_row ) = $end ? | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | $self->_parse_column_row( $end ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | ( undef, undef ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | ###LogSD 'Start column: ' . ($start_column//'undef'), 'Start row: ' . ($start_row//'undef'), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | ###LogSD 'End column: ' . ($end_column//'undef'), 'End row: ' . ($end_row//'undef') ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 30 | $self->_set_min_col( $start_column ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 30 | $self->_set_min_row( $start_row ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 30 | ▶ | $self->_set_max_col( $end_column ) if defined $end_column; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 30 | ▶ | $self->_set_max_row( $end_row ) if defined $end_row; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 30 | $good_load = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $self->_set_min_col( 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $self->_set_min_row( 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $self->set_error( "No sheet dimensions provided" ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # Work without a net !!!!! | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 30 | $self->change_stack_storage_to( 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | #pull column stats | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | ###LogSD "Checking if column data should be collected: " . $self->collecting_column_formats ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 30 | ▶ | if( $self->collecting_column_formats ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 26 | ▶ | if( $node_name eq 'EOF' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | $self->start_the_file_over; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 26 | ( $result, $node_name, $node_level, $node_ref ) = $self->advance_element_position( 'cols' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | ###LogSD "Arrived at node named -$node_name- with result: $result", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 26 | ▶ | if( $result ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # Build the node and add it to the stack | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 19 | my $node_ref = $self->initial_node_build( $node_name, $node_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | ###LogSD "Returned from initial node build with node:", $node_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 19 | $self->add_node_to_stack( $node_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # Pull the data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 19 | my $column_data = $self->parse_element; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | ###LogSD "parsed column elements to:", $column_data ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # Process the data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 19 | my $column_store = []; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 19 | for my $definition ( @{$column_data->{list}} ){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 64 | ▶ | next if !is_HashRef( $definition ) or !is_HashRef( $definition->{attributes} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&is_HashRef($definition) and &is_HashRef($definition->{"attributes"})
MC/DC0%0/2
&is_HashRef($definition) and &is_HashRef($definition->{"attributes"})
&is_HashRef($definition)
&is_HashRef($definition->{"attributes"})
Truth table33%1/3
A and B
A= &is_HashRef($definition)B= &is_HashRef($definition->{"attributes"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | ###LogSD "Processing:", $definition ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 64 | my $row_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 64 | ▶ | map{ $row_ref->{$_} = $definition->{attributes}->{$_} if defined $definition->{attributes}->{$_} } qw( width customWidth bestFit hidden ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | ###LogSD "Updated row ref:", $row_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 64 | for my $col ( $definition->{attributes}->{min} .. $definition->{attributes}->{max} ){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 32825 | $column_store->[$col] = $row_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ###LogSD "Updated column store is:", $column_store ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | ###LogSD "Final column store is:", $column_store ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 19 | $good_load = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 19 | $self->_set_column_formats( $column_store ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # Get sheet meta data merge information | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 30 | my $merge_ref = []; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | ###LogSD "Checking if merged data should be collected: " . $self->collecting_merge_data ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 30 | ▶ | if( $self->collecting_merge_data ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 26 | ▶ | if( $node_name eq 'EOF' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 7 | $self->start_the_file_over; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 26 | ( $result, $node_name, $node_level, $node_ref ) = $self->advance_element_position( 'mergeCells' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | ###LogSD "Arrived at node named -$node_name- with result: $result", ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 26 | ▶ | if( $result ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # Build the node and add it to the stack | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 10 | my $node_ref = $self->initial_node_build( $node_name, $node_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | ###LogSD $phone->talk( level => 'debug', message =>[ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | ###LogSD "Returned from initial node build with node:", $node_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 10 | $self->add_node_to_stack( $node_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 10 | my $merge_range = $self->parse_element; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | ###LogSD "Processing all merge ranges:", $merge_range ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 10 | $merge_range = $self->squash_node( $merge_range ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | ###LogSD "squashed merge range:", $merge_range ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 10 | my $final_ref = []; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 10 | for my $merge_ref ( @{$merge_range->{list}} ){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | ###LogSD "parsed merge element to:", $merge_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 18 | my ( $start, $end ) = split /:/, $merge_ref->{ref}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 18 | my ( $start_col, $start_row ) = $self->_parse_column_row( $start ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 18 | my ( $end_col, $end_row ) = $self->_parse_column_row( $end ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | ###LogSD "Start column: $start_col", "Start row: $start_row", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | ###LogSD "End column: $end_col", "End row: $end_row" ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 18 | my $min_col = $start_col; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 18 | ▶ | while ( $start_row <= $end_row ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 38 | $final_ref->[$start_row]->[$start_col] = $merge_ref->{ref}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 38 | $start_col++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 38 | ▶ | if( $start_col > $end_col ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 20 | $start_col = $min_col; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 20 | $start_row++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | ###LogSD "Final merge ref:", $final_ref ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 10 | $good_load = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 10 | $self->_set_merge_map( $final_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | }# exit 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | # Record file state | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 30 | ▶ | if( $good_load ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | ###LogSD $phone->talk( level => 'debug', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | ###LogSD "The Worksheet file has metadata" ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 30 | $self->good_load( 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $self->set_error( "No 'Worksheet' definition elements found - can't parse this as a Worksheet file" ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 30 | $self->start_the_file_over; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | ###LogSD $phone->talk( level => 'trace', message => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | ###LogSD "Finished the worksheet unique bits" ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 30 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | #########1 Private Attributes 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 17 | has _sheet_min_col =>( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | isa => Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | writer => '_set_min_col', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | reader => '_min_col', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | predicate => 'has_min_col', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 17 | has _sheet_min_row =>( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | isa => Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | writer => '_set_min_row', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | reader => '_min_row', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | predicate => 'has_min_row', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 17 | has _sheet_max_col =>( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | isa => Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | writer => '_set_max_col', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | reader => '_max_col', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | predicate => 'has_max_col', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 17 | has _sheet_max_row =>( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | isa => Int, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | writer => '_set_max_row', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | reader => '_max_row', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | predicate => 'has_max_row', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | has _column_formats =>( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | isa => ArrayRef, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | traits => ['Array'], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | writer => '_set_column_formats', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | reader => '_get_column_formats', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 30 | ▶ | default => sub{ [] }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 17 | handles =>{ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | get_custom_column_data => 'get', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | has _row_formats =>( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | isa => ArrayRef, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | traits => ['Array'], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | writer => '_set_row_formats', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | reader => '_get_row_formats', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 30 | ▶ | default => sub{ [] }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 17 | handles =>{ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | get_custom_row_data => 'get', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | _set_custom_row_data => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | has _merge_map =>( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | isa => ArrayRef, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | traits => ['Array'], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | writer => '_set_merge_map', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | reader => 'get_merge_map', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 30 | ▶ | default => sub{ [] }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 17 | handles =>{ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | _get_row_merge_map => 'get', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | has _primary_merged_values =>(# Values for the top left corner of the merge range | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | isa => HashRef, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | traits => ['Hash'], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | reader => '_get_all_merged_values', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 30 | ▶ | default => sub{ {} }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 17 | handles =>{ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | _set_merged_value => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | _get_merged_value => 'get', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | #########1 Private Methods 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | #########1 Phinish 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 17 | ▶ | no Moose::Role; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 17 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | #########1 Documentation 3#########4#########5#########6#########7#########8#########9 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||