line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::TableX::Column; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1215
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use MooseX::Types; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use PDF::TableX::Types qw/StyleDefinition/; |
7
|
|
|
|
|
|
|
use PDF::TableX::Cell; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'PDF::TableX::Stylable'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has rows => (is => 'ro', isa => 'Int', default => 0); |
12
|
|
|
|
|
|
|
has width => (is => 'rw', isa => 'Num'); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use overload '@{}' => sub { return $_[0]->{_children} }, fallback => 1; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
around 'width' => sub { |
17
|
|
|
|
|
|
|
my $orig = shift; |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
return $self->$orig() unless @_; |
20
|
|
|
|
|
|
|
for (@{ $self->{_children} }) { $_->width(@_) }; |
21
|
|
|
|
|
|
|
$self->$orig(@_); |
22
|
|
|
|
|
|
|
return $self; |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub add_cell { |
26
|
|
|
|
|
|
|
my ($self, $cell) = @_; |
27
|
|
|
|
|
|
|
push @{$self->{_children}}, $cell; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_min_width { |
31
|
|
|
|
|
|
|
my ($self) = @_; |
32
|
|
|
|
|
|
|
my $width = 0; |
33
|
|
|
|
|
|
|
for my $cell_min_width ( map {$_->min_width} @{$self->{_children}} ) { |
34
|
|
|
|
|
|
|
$width = $cell_min_width if ($cell_min_width > $width); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
return $width; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub get_reg_width { |
40
|
|
|
|
|
|
|
my ($self) = @_; |
41
|
|
|
|
|
|
|
my $width = 0; |
42
|
|
|
|
|
|
|
for my $cell_reg_width ( map {$_->reg_width} @{$self->{_children}} ) { |
43
|
|
|
|
|
|
|
$width = $cell_reg_width if ($cell_reg_width > $width); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
return $width; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
PDF::TableX::Column |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Version 0.01 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SYNOPSIS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 add_cell |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
TODO |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 get_min_width |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
TODO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 get_reg_width |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
TODO |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Grzegorz Papkala, C<< <grzegorzpapkala at gmail.com> >> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 BUGS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Please report any bugs or feature requests at: L<https://github.com/grzegorzpapkala/PDF-TableX/issues> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SUPPORT |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
PDF::TableX is hosted on GitHub L<https://github.com/grzegorzpapkala/PDF-TableX> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Copyright 2013 Grzegorz Papkala, all rights reserved. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
93
|
|
|
|
|
|
|
under the same terms as Perl itself. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |