| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Document::Writer::Page; |
|
2
|
1
|
|
|
1
|
|
5407
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
extends 'Graphics::Primitive::Container'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Graphics::Primitive::Insets; |
|
7
|
|
|
|
|
|
|
use Graphics::Primitive::TextBox; |
|
8
|
|
|
|
|
|
|
use Layout::Manager::Compass; |
|
9
|
|
|
|
|
|
|
use Layout::Manager::Flow; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# use Graphics::Color::RGB; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'body' => ( |
|
14
|
|
|
|
|
|
|
is => 'rw', |
|
15
|
|
|
|
|
|
|
isa => 'Graphics::Primitive::Component', |
|
16
|
|
|
|
|
|
|
default => sub { |
|
17
|
|
|
|
|
|
|
my ($self) = @_; |
|
18
|
|
|
|
|
|
|
Graphics::Primitive::Container->new( |
|
19
|
|
|
|
|
|
|
layout_manager => Layout::Manager::Flow->new, |
|
20
|
|
|
|
|
|
|
class => 'dw-body' |
|
21
|
|
|
|
|
|
|
) |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
has 'color' => ( |
|
25
|
|
|
|
|
|
|
is => 'rw', |
|
26
|
|
|
|
|
|
|
isa => 'Graphics::Color', |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
has 'footer' => ( |
|
29
|
|
|
|
|
|
|
is => 'rw', |
|
30
|
|
|
|
|
|
|
isa => 'Graphics::Primitive::Component', |
|
31
|
|
|
|
|
|
|
default => sub { |
|
32
|
|
|
|
|
|
|
return Graphics::Primitive::TextBox->new( |
|
33
|
|
|
|
|
|
|
# text => 'Footer', |
|
34
|
|
|
|
|
|
|
class => 'dw-footer' |
|
35
|
|
|
|
|
|
|
) |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
has 'header' => ( |
|
39
|
|
|
|
|
|
|
is => 'rw', |
|
40
|
|
|
|
|
|
|
isa => 'Graphics::Primitive::Component', |
|
41
|
|
|
|
|
|
|
default => sub { |
|
42
|
|
|
|
|
|
|
return Graphics::Primitive::TextBox->new( |
|
43
|
|
|
|
|
|
|
# text => 'Header', |
|
44
|
|
|
|
|
|
|
class => 'dw-header' |
|
45
|
|
|
|
|
|
|
) |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
# has '+margins' => ( default => sub { |
|
49
|
|
|
|
|
|
|
# Graphics::Primitive::Insets->new( left => 90, right => 90, top => 72, bottom => 72); |
|
50
|
|
|
|
|
|
|
# }); |
|
51
|
|
|
|
|
|
|
has '+layout_manager' => ( default => sub { Layout::Manager::Compass->new }); |
|
52
|
|
|
|
|
|
|
has '+page' => ( default => sub { 1 }); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub BUILD { |
|
55
|
|
|
|
|
|
|
my ($self) = @_; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$self->add_component($self->header, 'n'); |
|
58
|
|
|
|
|
|
|
$self->add_component($self->footer, 's'); |
|
59
|
|
|
|
|
|
|
$self->add_component($self->body, 'c'); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
override('prepare', sub { |
|
63
|
|
|
|
|
|
|
my ($self, $driver) = @_; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
if(defined($self->header) && !$self->header->minimum_width) { |
|
66
|
|
|
|
|
|
|
$self->header->minimum_width($self->inside_width + $self->header->outside_width); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
if(defined($self->footer) && !$self->footer->minimum_width) { |
|
69
|
|
|
|
|
|
|
$self->footer->minimum_width($self->inside_width + $self->footer->outside_width); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
if(defined($self->body) && !$self->body->minimum_width) { |
|
72
|
|
|
|
|
|
|
$self->body->minimum_width($self->inside_width + $self->body->outside_width); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
super; |
|
76
|
|
|
|
|
|
|
}); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
|
81
|
|
|
|
|
|
|
__END__ |
|
82
|
|
|
|
|
|
|
=head1 NAME |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Document::Writer::Page - A page in a document |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
use Document::Writer; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $doc = Document::Writer->new(default_color => ...); |
|
91
|
|
|
|
|
|
|
my $p = $doc->next_page($width, $height); |
|
92
|
|
|
|
|
|
|
$p->add_text_to_page($driver, $font, $text); |
|
93
|
|
|
|
|
|
|
... |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 METHODS |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 body |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Set/Get this page's body container. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 footer |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Set/Get this page's footer component. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 header |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Set/Get this page's footer component. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 BUILD |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Moose hackery, ignore me. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Cory Watson, C<< <gphat@cpan.org> >> |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 BUGS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-geometry-primitive at rt.cpan.org>, or through |
|
120
|
|
|
|
|
|
|
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geometry-Primitive>. I will be notified, and then you'll |
|
121
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
126
|
|
|
|
|
|
|
under the same terms as Perl itself. |