File: Row.pm

package info (click to toggle)
libpdf-fromhtml-perl 0.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 576 kB
  • sloc: perl: 4,876; makefile: 15
file content (99 lines) | stat: -rw-r--r-- 1,532 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package PDF::FromHTML::Template::Container::Row;

use strict;

BEGIN {
    use vars qw(@ISA);
    @ISA = qw(PDF::FromHTML::Template::Container);

    use PDF::FromHTML::Template::Container;
}

sub enter_scope
{
    my $self = shift;
    my ($context) = @_;

    $self->SUPER::enter_scope($context);

    $context->{X} = $context->get($self, 'LEFT_MARGIN');

    return 1;
}

sub deltas
{
    my $self = shift;
    my ($context) = @_;

    return {
        X => $context->get($self, 'X') * -1 + $context->get($self, 'LEFT_MARGIN'),
        Y => -1 * $self->max_of($context, 'H'),
    };
}

sub total_of
{
    my $self = shift;
    my ($context, $attr) = @_;

    return $self->max_of($context, $attr) if $attr eq 'H';

    return $self->SUPER::total_of($context, $attr);
}

1;
__END__

=head1 NAME

PDF::FromHTML::Template::Container::Row - Specify a row of text and provide
typewriter-like carriage returns at the end

=head1 NODE NAME

ROW

=head1 INHERITANCE

PDF::FromHTML::Template::Container

=head1 ATTRIBUTES

=over 4

=item * H - the height the row will consume when it is done.

=item * LEFT_MARGIN - If specified, the row will start rendering here. Otherwise,
it will default to the PAGEDEF's LEFT_MARGIN.

=back

=head1 CHILDREN

None

=head1 AFFECTS

TEXTBOX

=head1 DEPENDENCIES

None

=head1 USAGE

  <row h="8">
    <textbox w="50%" justify="right" text"Hello,"/>
    <textbox w="50%" justify="left" text"World"/>
  </row>

=head1 AUTHOR

Rob Kinyon (rkinyon@columbus.rr.com)

=head1 SEE ALSO

PAGEDEF, TEXTBOX

=cut