| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PDF::Table::Settings; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
31
|
use strict; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
128
|
|
|
4
|
4
|
|
|
4
|
|
25
|
use warnings; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
98
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
18
|
use Carp; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
2804
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.005'; # VERSION |
|
9
|
|
|
|
|
|
|
our $LAST_UPDATE = '1.003'; # manually update whenever code is changed |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
########################################################### |
|
12
|
|
|
|
|
|
|
# move deprecated settings names to current names, and delete old |
|
13
|
|
|
|
|
|
|
# assume any leading '-' already removed |
|
14
|
|
|
|
|
|
|
# warning if both deprecated and new name given (use new) |
|
15
|
|
|
|
|
|
|
# release at T-6 months, consider issuing warning to remind update needed |
|
16
|
|
|
|
|
|
|
# release at T-0 months, give warning on use of deprecated items |
|
17
|
|
|
|
|
|
|
# release at T+12 months, remove deprecated names |
|
18
|
|
|
|
|
|
|
############################################################ |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub deprecated_settings { |
|
21
|
10
|
|
|
10
|
0
|
42
|
my ($data, $row_props, $col_props, $cell_props, $header_props, $argref) = @_; |
|
22
|
|
|
|
|
|
|
# 1 $row_props, 2 $col_props, 3 $cell_props, 4 $header_props |
|
23
|
|
|
|
|
|
|
# need to use $_[n] form so that its call be reference, not value |
|
24
|
|
|
|
|
|
|
#my $data = $_[0]; |
|
25
|
|
|
|
|
|
|
#my $argref = $_[5]; |
|
26
|
|
|
|
|
|
|
#my %arg = %{$argref}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
10
|
|
|
|
|
118
|
my %cur_names = ( |
|
29
|
|
|
|
|
|
|
# old deprecated name new current name |
|
30
|
|
|
|
|
|
|
# (old_key) |
|
31
|
|
|
|
|
|
|
'start_y' => 'y', |
|
32
|
|
|
|
|
|
|
'start_h' => 'h', |
|
33
|
|
|
|
|
|
|
'row_height' => 'min_rh', |
|
34
|
|
|
|
|
|
|
'background_color' => 'bg_color', |
|
35
|
|
|
|
|
|
|
'background_color_odd' => 'bg_color_odd', |
|
36
|
|
|
|
|
|
|
'background_color_even' => 'bg_color_even', |
|
37
|
|
|
|
|
|
|
'font_color' => 'fg_color', |
|
38
|
|
|
|
|
|
|
'font_color_odd' => 'fg_color_odd', |
|
39
|
|
|
|
|
|
|
'font_color_even' => 'fg_color_even', |
|
40
|
|
|
|
|
|
|
'font_underline' => 'underline', |
|
41
|
|
|
|
|
|
|
#'justify' => 'align', # different set of values allowed |
|
42
|
|
|
|
|
|
|
'lead' => 'leading', |
|
43
|
|
|
|
|
|
|
'border' => 'border_w', |
|
44
|
|
|
|
|
|
|
'horizontal_borders' => 'h_border_w', |
|
45
|
|
|
|
|
|
|
'vertical_borders' => 'v_border_w', |
|
46
|
|
|
|
|
|
|
'border_color' => 'border_c', |
|
47
|
|
|
|
|
|
|
# currently same color for H and V borders |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# global arg |
|
51
|
10
|
|
|
|
|
49
|
foreach my $old_key (keys %cur_names) { |
|
52
|
150
|
100
|
|
|
|
276
|
if (defined $argref->{$old_key}) { |
|
53
|
|
|
|
|
|
|
# set deprecated name setting (need to transfer to new name). |
|
54
|
|
|
|
|
|
|
# did we also set new name setting? |
|
55
|
14
|
50
|
|
|
|
33
|
if (defined $argref->{$cur_names{$old_key}}) { |
|
56
|
0
|
|
|
|
|
0
|
carp "!! Warning !! both deprecated global name '$old_key' and current name '$cur_names{$old_key}' given, current name's value used."; |
|
57
|
|
|
|
|
|
|
} else { |
|
58
|
14
|
|
|
|
|
27
|
$argref->{$cur_names{$old_key}} = $argref->{$old_key}; |
|
59
|
14
|
|
|
|
|
26
|
delete $argref->{$old_key}; |
|
60
|
|
|
|
|
|
|
# eventually given warning to stop using $old_key |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# row properties |
|
66
|
10
|
|
|
|
|
40
|
foreach my $old_key (keys %cur_names) { |
|
67
|
150
|
|
|
|
|
273
|
for (my $row = 0; $row < scalar(@$data); $row++) { |
|
68
|
285
|
50
|
|
|
|
622
|
if (defined $row_props->[$row]->{$old_key}) { |
|
69
|
|
|
|
|
|
|
# set deprecated name setting (need to transfer to new name). |
|
70
|
0
|
0
|
|
|
|
0
|
if (defined $row_props->[$row]->{$cur_names{$old_key}}) { |
|
71
|
|
|
|
|
|
|
# did we also set new name setting? |
|
72
|
0
|
|
|
|
|
0
|
carp "!! Warning !! both deprecated name '$old_key' and current name '$cur_names{$old_key}' given in row_props[$row], current name's value used."; |
|
73
|
|
|
|
|
|
|
} else { |
|
74
|
|
|
|
|
|
|
# transfer deprecated setting to new |
|
75
|
0
|
|
|
|
|
0
|
$row_props->[$row]->{$cur_names{$old_key}} = $row_props->[$row]->{$old_key}; |
|
76
|
0
|
|
|
|
|
0
|
delete $row_props->[$row]->{$old_key}; |
|
77
|
|
|
|
|
|
|
# eventually given warning to stop using $old_key |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# column properties |
|
84
|
10
|
|
|
|
|
42
|
foreach my $old_key (keys %cur_names) { |
|
85
|
150
|
|
|
|
|
233
|
for (my $col = 0; $col < scalar(@{$col_props}); $col++) { |
|
|
345
|
|
|
|
|
630
|
|
|
86
|
195
|
100
|
|
|
|
333
|
if (defined $col_props->[$col]->{$old_key}) { |
|
87
|
|
|
|
|
|
|
# set deprecated name setting (need to transfer to new name). |
|
88
|
8
|
50
|
|
|
|
35
|
if (defined $col_props->[$col]->{$cur_names{$old_key}}) { |
|
89
|
|
|
|
|
|
|
# did we also set new name setting? |
|
90
|
0
|
|
|
|
|
0
|
carp "!! Warning !! both deprecated name '$old_key' and current name '$cur_names{$old_key}' given in column_props[$col], current name's value used."; |
|
91
|
|
|
|
|
|
|
} else { |
|
92
|
|
|
|
|
|
|
# transfer deprecated setting to new |
|
93
|
8
|
|
|
|
|
20
|
$col_props->[$col]->{$cur_names{$old_key}} = $col_props->[$col]->{$old_key}; |
|
94
|
8
|
|
|
|
|
14
|
delete $col_props->[$col]->{$old_key}; |
|
95
|
|
|
|
|
|
|
# eventually given warning to stop using $old_key |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# cell properties |
|
102
|
10
|
|
|
|
|
50
|
foreach my $old_key (keys %cur_names) { |
|
103
|
150
|
|
|
|
|
280
|
for (my $row = 0; $row < scalar(@$data); $row++) { |
|
104
|
285
|
|
|
|
|
374
|
for ( my $col = 0; |
|
105
|
1035
|
|
|
|
|
1870
|
$col < scalar(@{$data->[$row]}); |
|
106
|
|
|
|
|
|
|
$col++ ) { |
|
107
|
750
|
100
|
|
|
|
1284
|
if (defined $cell_props->[$row][$col]->{$old_key}) { |
|
108
|
|
|
|
|
|
|
# set deprecated name setting (need to transfer to new name). |
|
109
|
2
|
50
|
|
|
|
5
|
if (defined $cell_props->[$row][$col]->{$cur_names{$old_key}}) { |
|
110
|
|
|
|
|
|
|
# did we also set new name setting? |
|
111
|
0
|
|
|
|
|
0
|
carp "!! Warning !! both deprecated name '$old_key' and current name '$cur_names{$old_key}' given in cell_props[$row][$col], current name's value used."; |
|
112
|
|
|
|
|
|
|
} else { |
|
113
|
|
|
|
|
|
|
# transfer deprecated setting to new |
|
114
|
2
|
|
|
|
|
6
|
$cell_props->[$row][$col]->{$cur_names{$old_key}} = $cell_props->[$row][$col]->{$old_key}; |
|
115
|
2
|
|
|
|
|
3
|
delete $cell_props->[$row][$col]->{$old_key}; |
|
116
|
|
|
|
|
|
|
# eventually given warning to stop using $old_key |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# header properties |
|
124
|
10
|
100
|
|
|
|
34
|
if ($header_props) { |
|
125
|
1
|
|
|
|
|
4
|
foreach my $old_key (keys %cur_names) { |
|
126
|
15
|
50
|
|
|
|
27
|
if (defined $header_props->{$old_key}) { |
|
127
|
|
|
|
|
|
|
# set deprecated name setting (need to transfer to new name). |
|
128
|
|
|
|
|
|
|
# did we also set new name setting? |
|
129
|
0
|
0
|
|
|
|
0
|
if (defined $header_props->{$cur_names{$old_key}}) { |
|
130
|
0
|
|
|
|
|
0
|
carp "!! Warning !! both deprecated header name '$old_key' and current name '$cur_names{$old_key}' given, current name's value used."; |
|
131
|
|
|
|
|
|
|
} else { |
|
132
|
0
|
|
|
|
|
0
|
$header_props->{$cur_names{$old_key}} = $header_props->{$old_key}; |
|
133
|
0
|
|
|
|
|
0
|
delete $header_props->{$old_key}; |
|
134
|
|
|
|
|
|
|
# eventually given warning to stop using $old_key |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
10
|
|
|
|
|
46
|
return; |
|
141
|
|
|
|
|
|
|
} # end of deprecated_settings() |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
############################################################ |
|
144
|
|
|
|
|
|
|
# validate/fix up settings and parameters as much as possible TBD per #12 |
|
145
|
|
|
|
|
|
|
############################################################ |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub check_settings { |
|
148
|
10
|
|
|
10
|
0
|
45
|
my (%arg) = @_; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# TBD $arg{} values, some col, row, cell, header? |
|
151
|
|
|
|
|
|
|
# x, y >= 0; w, h >= 0; x+w < page width; y+h < page height |
|
152
|
|
|
|
|
|
|
# next_h (if def) > 0, next_y (if def) >= 0; next_y+next_h < page height |
|
153
|
|
|
|
|
|
|
# line widths >= 0, min_rh > 0 |
|
154
|
|
|
|
|
|
|
# TBD in general, validate integer values and possibly some |
|
155
|
|
|
|
|
|
|
# other values, per #12 |
|
156
|
10
|
|
|
|
|
63
|
return; |
|
157
|
|
|
|
|
|
|
} # end of check_settings() |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
1; |