| 1 | package Khonsu::Form::Field; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 3 | ▶ | use parent 'Khonsu::Text'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 3 | ▶ | use PDF::API2::Basic::PDF::Utils; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 3 | ▶ | use PDF::API2::Basic::PDF::Utils; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | sub attributes { | ||||||||||||||||||||
| 9 | 2 | ▶ | my $a = shift; | ||||||||||||||||||
|
Subroutine
attributes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 10 | return ( | ||||||||||||||||||||
| 11 | 2 | $a->SUPER::attributes(), | |||||||||||||||||||
| 12 | xo => { $a->RW, $a->OBJ }, | ||||||||||||||||||||
| 13 | annotate => { $a->RW, $a->OBJ }, | ||||||||||||||||||||
| 14 | name => { $a->RW, $a->STR }, | ||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | sub add { | ||||||||||||||||||||
| 19 | 1 | ▶ | my ($self, $file, %args) = @_; | ||||||||||||||||||
|
Subroutine
add: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 1 | my %position = $self->get_points(); | |||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | my $field = $self->xo( | |||||||||||||||||||
| 24 | $file->pdf->xo_form() | ||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 1 | $self->SUPER::add($file, pad => '_', %args); | |||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 1 | my $annotate = $self->annotate( | |||||||||||||||||||
| 30 | $file->page->current->annotation | ||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||
| 32 | 1 | $field->{OpenAction} = PDFArray($self->annotate, PDFName('XYZ'), PDFNull, PDFNull, PDFNum(0)); | |||||||||||||||||||
| 33 | 1 | $field->bbox(0, 0, 149.8, 14.4); | |||||||||||||||||||
| 34 | 1 | $annotate->{DR} = $self->font->load(); | |||||||||||||||||||
| 35 | 1 | ▶ | $annotate->{T} = PDFStr($self->name || $args{text}); | ||||||||||||||||||
|
Condition33%1/3
$self->name || $args{'text'}
MC/DC0%0/2
$self->name || $args{'text'}
$self->name
$args{'text'}
Truth table33%1/3
A || B
A= $self->nameB= $args{'text'}
| |||||||||||||||||||||
| 36 | 1 | $annotate->{Subtype} = PDFName('Widget'); | |||||||||||||||||||
| 37 | 1 | $annotate->{P} = $file->page->current; | |||||||||||||||||||
| 38 | 1 | ▶ | $args{position} ||= \@pps; | ||||||||||||||||||
|
Condition50%1/2
$args{"position"} ||= \@pps
MC/DC0%0/1
$args{"position"} ||= \@pps
$args{"position"}
Truth table50%1/2
A
A= $args{"position"}
| |||||||||||||||||||||
| 39 | 1 | ▶ | $self->configure(%args) if $self->can('configure'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | 1 | $self->set_rect($file, %args); | |||||||||||||||||||
| 41 | 1 | $file->form->add_to_fields($file, $self->annotate); | |||||||||||||||||||
| 42 | 1 | return $file; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | sub set_rect { | ||||||||||||||||||||
| 46 | 1 | ▶ | my ($self, $file, %args) = @_; | ||||||||||||||||||
|
Subroutine
set_rect: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 47 | 1 | my %position = $self->get_points(); | |||||||||||||||||||
| 48 | 1 | $position{y} = $file->page->h - $position{y}; | |||||||||||||||||||
| 49 | my @pos = ( | ||||||||||||||||||||
| 50 | $self->end_w + 2, | ||||||||||||||||||||
| 51 | $position{y} + ($self->font->size*0.2), | ||||||||||||||||||||
| 52 | $position{w}, | ||||||||||||||||||||
| 53 | 1 | $position{y} - ($self->font->size*1.4) | |||||||||||||||||||
| 54 | ); | ||||||||||||||||||||
| 55 | 1 | $self->annotate->rect(@pos); | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 3 | 1; | |||||||||||||||||||