API3/Compat/API2/Basic/PDF/Pages.pm

filter: Statementstmt 11.0% 19 / 172 Branchbran 0.0% 0 / 92 Conditioncond 0.0% 0 / 35 MC/DCmcdc 0.0% 0 / 21 Subroutinesub 22.7% 5 / 22 Podpod 64.7% 11 / 17 totaltotal 9.7% 35 / 359 CC 66 SCAR 42.8
CC
66
Cov
6%
add_font
156.0
add_page
132.0
proc_set
110.0
CRAP 72.4
« API3/Compat/API2/Outline.pm ↑ Summary API3/Compat/API2/Basic/TTF/GDEF.pm »
1 #=======================================================================
2 # ____ ____ _____ _ ____ ___ ____
3 # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
4 # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
5 # | __/| |_| | _| _ _ / ___ \| __/| | / __/
6 # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
7 #
8 # A Perl Module Chain to faciliate the Creation and Modification
9 # of High-Quality "Portable Document Format (PDF)" Files.
10 #
11 #=======================================================================
12 #
13 # THIS IS A REUSED PERL MODULE, FOR PROPER LICENCING TERMS SEE BELOW:
14 #
15 #
16 # Copyright Martin Hosken <Martin_Hosken@sil.org>
17 #
18 # No warranty or expression of effectiveness, least of all regarding
19 # anyone's safety, is implied in this software or documentation.
20 #
21 # This specific module is licensed under the Perl Artistic License.
22 #
23 #
24 # $Id: Pages.pm,v 2.1 2007/05/10 06:44:43 areibens Exp $
25 #
26 #=======================================================================
27 package PDF::API3::Compat::API2::Basic::PDF::Pages;
28
29 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use vars qw(@ISA %inst);
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 @ISA = qw(PDF::API3::Compat::API2::Basic::PDF::Dict);
32 1 ▶no warnings qw[ deprecated recursion uninitialized ];
Subroutine BEGIN: called CC=1 SCAR=0.0
33
34 1 ▶use PDF::API3::Compat::API2::Basic::PDF::Dict;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 ▶use PDF::API3::Compat::API2::Basic::PDF::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
36
37 1 %inst = map {$_ => 1} qw(Parent Type);
38
39 =head1 NAME
40
41 PDF::API3::Compat::API2::Basic::PDF::Pages - a PDF pages hierarchical element. Inherits from L<PDF::API3::Compat::API2::Basic::PDF::Dict>
42
43 =head1 DESCRIPTION
44
45 A Pages object is the parent to other pages objects or to page objects
46 themselves.
47
48 =head1 METHODS
49
50 =head2 PDF::API3::Compat::API2::Basic::PDF::Pages->new($pdfs,$parent)
51
52 This creates a new Pages object. Notice that $parent here is not the
53 file context for the object but the parent pages object for this
54 pages. If we are using this class to create a root node, then $parent
55 should point to the file context, which is identified by not having a
56 Type of Pages. $pdfs is the file object (or objects) in which to
57 create the new Pages object.
58
59 =cut
60
61 sub new
62 0 ▶{
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
63 0 my ($class, $pdfs, $parent) = @_;
64 0 my ($self);
65
66 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
67 0 $self = $class->SUPER::new($pdfs, $parent);
68 0 $self->{'Type'} = PDFName("Pages");
69 0 ▶ $self->{'Parent'} = $parent if defined $parent;
Branch: 1 branch
BranchTrueFalseTotal
if defined $parent 0 0 0
70 0 $self->{'Count'} = PDFNum(0);
71 0 $self->{'Kids'} = PDF::API3::Compat::API2::Basic::PDF::Array->new;
72 0 ▶ $self->{' outto'} = ref $pdfs eq 'ARRAY' ? $pdfs : [$pdfs];
Branch: 1 branch
BranchTrueFalseTotal
ref $pdfs eq 'ARRAY' ? : 0 0 0
73 0 $self->out_obj(1);
74
75 0 $self;
76 }
77
78
79 sub init
80 0 ▶{
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my ($self, $pdf) = @_;
82 0 $self->{' outto'} = [$pdf];
83 0 $self;
84 }
85
86 =head2 $p->out_obj($isnew)
87
88 Tells all the files that this thing is destined for that they should output this
89 object come time to output. If this object has no parent, then it must be the
90 root. So set as the root for the files in question and tell it to be output too.
91 If $isnew is set, then call new_obj rather than out_obj to create as a new
92 object in the file.
93
94 =cut
95
96 sub out_obj
97 0 ▶{
Subroutine out_obj: not called CC=4 SCAR=30.0
Pod documented
98 0 my ($self, $isnew) = @_;
99
100 0 foreach (@{$self->{' outto'}})
101 {
102 0 ▶ if ($isnew)
Branch: 1 branch
BranchTrueFalseTotal
if ($isnew) { } 0 0 0
103 0 { $_->new_obj($self); }
104 else
105 0 { $_->out_obj($self); }
106
107 0 ▶ unless (defined $self->{'Parent'})
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Parent"}) 0 0 0
108 {
109 0 $_->{'Root'}{'Pages'} = $self;
110 0 $_->out_obj($_->{'Root'});
111 }
112 }
113 0 $self;
114 }
115
116
117 =head2 $p->find_page($pnum)
118
119 Returns the given page, using the page count values in the pages tree. Pages
120 start at 0.
121
122 =cut
123
124 sub find_page
125 0 ▶{
Subroutine find_page: not called CC=1 SCAR=6.9
Pod documented
126 0 my ($self, $pnum) = @_;
127 0 my ($top) = $self->get_top;
128
129 0 $top->find_page_recurse(\$pnum);
130 }
131
132
133 sub find_page_recurse
134 0 ▶{
Subroutine find_page_recurse: not called CC=6 SCAR=37.4
Pod undocumented
135 0 my ($self, $rpnum) = @_;
136 0 my ($res, $k);
137
138 0 ▶ if ($self->{'Count'}->realise->val <= $$rpnum)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Count"}->realise->val <= $$rpnum) 0 0 0
139 {
140 0 $$rpnum -= $self->{'Count'}->val;
141 0 return undef;
142 }
143
144 0 foreach $k ($self->{'Kids'}->realise->elementsof)
145 {
146 0 ▶ if ($k->{'Type'}->realise->val eq 'Page')
Branch: 2 branches
BranchTrueFalseTotal
if ($k->{'Type'}->realise->val eq 'Page') { } 0 0 0
elsif ($res = $k->realise->find_page_recurse($rpnum)) { } 0 0 0
147 {
148 0 ▶ return $k if ($$rpnum == 0);
Branch: 1 branch
BranchTrueFalseTotal
if $$rpnum == 0 0 0 0
149 0 $$rpnum--;
150 }
151 elsif ($res = $k->realise->find_page_recurse($rpnum))
152 0 { return $res; }
153 }
154 0 return undef;
155 }
156
157 =head2 $p->add_page($page, $pnum)
158
159 Inserts the page before the given $pnum. $pnum can be -ve to count from the END
160 of the document. -1 is after the last page. Likewise $pnum can be greater than the
161 number of pages currently in the document, to append.
162
163 This method only guarantees to provide a reasonable pages tree if pages are
164 appended or prepended to the document. Pages inserted in the middle of the
165 document may simply be inserted in the appropriate leaf in the pages tree without
166 adding any new branches or leaves. To tidy up such a mess, it is best to call
167 $p->rebuild_tree to rebuild the pages tree into something efficient.
168
169 =cut
170
171 sub add_page
172 0 ▶{
Subroutine add_page: not called CC=11 SCAR=48.8
Pod documented
173 0 my ($self, $page, $pnum) = @_;
174 0 my ($top) = $self->get_top;
175 0 my ($ppage, $ppages, $pindex, $ppnum);
176
177 0 ▶ $pnum = -1 unless (defined $pnum && $pnum <= $top->{'Count'}->val);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pnum and $pnum <= $top->{"Count"}->val 0 0 0
Condition0%0/3
defined $pnum and $pnum <= $top->{"Count"}->val
!ll&&!rl&&r
000
MC/DC0%0/2
defined $pnum and $pnum <= $top->{"Count"}->val
defined $pnum $pnum <= $top->{"Count"}->val
Truth table0%0/3
A and B
A= defined $pnumB= $pnum <= $top->{"Count"}->val
ABresult
0X0
100
111
178 0 ▶ if ($pnum == -1)
Branch: 1 branch
BranchTrueFalseTotal
if ($pnum == -1) { } 0 0 0
179 0 { $ppage = $top->find_page($top->{'Count'}->val - 1); }
180 else
181 {
182 0 ▶ $pnum = $top->{'Count'}->val + $pnum + 1 if ($pnum < 0);
Branch: 1 branch
BranchTrueFalseTotal
if $pnum < 0 0 0 0
183 0 $ppage = $top->find_page($pnum);
184 }
185
186 0 ▶ if (defined $ppage->{'Parent'})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ppage->{'Parent'}) { } 0 0 0
187 0 { $ppages = $ppage->{'Parent'}->realise; }
188 else
189 0 { $ppages = $self; }
190
191 0 $ppnum = scalar $ppages->{'Kids'}->realise->elementsof;
192
193 0 ▶ if ($pnum == -1)
Branch: 1 branch
BranchTrueFalseTotal
if ($pnum == -1) { } 0 0 0
194 0 { $pindex = -1; }
195 else
196 {
197 0 ▶ for ($pindex = 0; $pindex < $ppnum; $pindex++)
Branch: 1 branch
BranchTrueFalseTotal
if ($pindex < $ppnum) 0 0 0
198 0 ▶ { last if ($ppages->{'Kids'}{' val'}[$pindex] eq $ppage); }
Branch: 1 branch
BranchTrueFalseTotal
if $ppages->{"Kids"}{" val"}[$pindex] eq $ppage 0 0 0
199 0 ▶ $pindex = -1 if ($pindex == $ppnum);
Branch: 1 branch
BranchTrueFalseTotal
if $pindex == $ppnum 0 0 0
200 }
201
202 0 $ppages->add_page_recurse($page->realise, $pindex);
203 0 ▶ for ($ppages = $page->{'Parent'}; defined $ppages->{'Parent'}; $ppages = $ppages->{'Parent'}->realise)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ppages->{"Parent"}) 0 0 0
204 0 { $ppages->out_obj->{'Count'}->realise->{'val'}++; }
205 0 $ppages->out_obj->{'Count'}->realise->{'val'}++;
206 0 $page;
207 }
208
209
210 sub add_page_recurse
211 0 ▶{
Subroutine add_page_recurse: not called CC=9 SCAR=45.0
Pod undocumented
212 0 my ($self, $page, $index) = @_;
213 0 my ($newpages, $ppages, $pindex, $ppnum);
214
215 0 ▶ if (scalar $self->{'Kids'}->elementsof >= 8 && $self->{'Parent'} && $index < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (scalar $self->{'Kids'}->elementsof >= 8 and $self->{'Parent'} and $index < 1) { } 0 0 0
Condition0%0/6
scalar $self->{"Kids"}->elementsof >= 8 and $self->{"Parent"} and $index < 1
!ll&&!rl&&r
000
scalar $self->{"Kids"}->elementsof >= 8 and $self->{"Parent"}
!ll&&!rl&&r
000
MC/DC0%0/3
scalar $self->{"Kids"}->elementsof >= 8 and $self->{"Parent"} and $index < 1
scalar $self->{"Kids"}->elementsof >= 8 $self->{"Parent"} $index < 1
Truth table0%0/4
A and B and C
A= scalar $self->{"Kids"}->elementsof >= 8B= $self->{"Parent"}C= $index < 1
ABCresult
0XX0
10X0
1100
1111
216 {
217 0 $ppages = $self->{'Parent'}->realise;
218 0 $newpages = $self->new($self->{' outto'}, $ppages);
219 0 ▶ if ($ppages)
Branch: 1 branch
BranchTrueFalseTotal
if ($ppages) 0 0 0
220 {
221 0 $ppnum = scalar $ppages->{'Kids'}->realise->elementsof;
222 0 ▶ for ($pindex = 0; $pindex < $ppnum; $pindex++)
Branch: 1 branch
BranchTrueFalseTotal
if ($pindex < $ppnum) 0 0 0
223 0 ▶ { last if ($ppages->{'Kids'}{' val'}[$pindex] eq $self); }
Branch: 1 branch
BranchTrueFalseTotal
if $ppages->{"Kids"}{" val"}[$pindex] eq $self 0 0 0
224 0 ▶ $pindex = -1 if ($pindex == $ppnum);
Branch: 1 branch
BranchTrueFalseTotal
if $pindex == $ppnum 0 0 0
225 0 $ppages->add_page_recurse($newpages, $pindex);
226 }
227 }
228 else
229 0 { $newpages = $self->out_obj; }
230
231 0 ▶ if ($index < 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($index < 0) { } 0 0 0
232 0 { push (@{$newpages->{'Kids'}->realise->{' val'}}, $page); }
233 else
234 0 { splice (@{$newpages->{'Kids'}{' val'}}, $index, 0, $page); }
235 0 $page->{'Parent'} = $newpages;
236 }
237
238
239 =head2 $root_pages = $p->rebuild_tree([@pglist])
240
241 Rebuilds the pages tree to make a nice balanced tree that conforms to Adobe
242 recommendations. If passed a pglist then the tree is built for that list of
243 pages. No check is made of whether the pglist contains pages.
244
245 Returns the top of the tree for insertion in the root object.
246
247 =cut
248
249 sub rebuild_tree
250 0 ▶{
Subroutine rebuild_tree: not called CC=1 SCAR=6.9
Pod documented
251 0 my ($self, @pglist) = @_;
252 }
253
254
255 =head2 @pglist = $p->get_pages
256
257 Returns a list of page objects in the document in page order
258
259 =cut
260
261 sub get_pages
262 0 ▶{
Subroutine get_pages: not called CC=1 SCAR=6.9
Pod documented
263 0 my ($self) = @_;
264
265 0 return $self->get_top->get_kids;
266 }
267
268
269 # only call this on the top level or anything you want pages below
270 sub get_kids
271 0 ▶{
Subroutine get_kids: not called CC=3 SCAR=24.8
Pod undocumented
272 0 my ($self) = @_;
273 0 my ($pgref, @pglist);
274
275 0 foreach $pgref ($self->{'Kids'}->elementsof)
276 {
277 0 $pgref->realise;
278 0 ▶ if ($pgref->{'Type'}->val =~ m/^Pages$/oi)
Branch: 1 branch
BranchTrueFalseTotal
if ($pgref->{'Type'}->val =~ /^Pages$/io) { } 0 0 0
279 0 { push (@pglist, $pgref->get_kids()); }
280 else
281 0 { push (@pglist, $pgref); }
282 }
283 0 @pglist;
284 }
285 =head2 $p->find_prop($key)
286
287 Searches up through the inheritance tree to find a property.
288
289 =cut
290
291 sub find_prop
292 0 ▶{
Subroutine find_prop: not called CC=5 SCAR=34.0
Pod undocumented
293 0 my ($self, $prop) = @_;
294
295 0 ▶ if (defined $self->{$prop})
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->{$prop}) { } 0 0 0
elsif (defined $self->{'Parent'}) { } 0 0 0
296 {
297 0 ▶ if (ref $self->{$prop} && $self->{$prop}->isa("PDF::API3::Compat::API2::Basic::PDF::Objind"))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{$prop} and $self->{$prop}->isa('PDF::API3::Compat::API2::Basic::PDF::Objind')) { } 0 0 0
Condition0%0/3
ref $self->{$prop} and $self->{$prop}->isa("PDF::API3::Compat::API2::Basic::PDF::Objind")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $self->{$prop} and $self->{$prop}->isa("PDF::API3::Compat::API2::Basic::PDF::Objind")
ref $self->{$prop} $self->{$prop}->isa("PDF::API3::Compat::API2::Basic::PDF::Objind")
Truth table0%0/3
A and B
A= ref $self->{$prop}B= $self->{$prop}->isa("PDF::API3::Compat::API2::Basic::PDF::Objind")
ABresult
0X0
100
111
298 0 { return $self->{$prop}->realise; }
299 else
300 0 { return $self->{$prop}; }
301 } elsif (defined $self->{'Parent'})
302 0 { return $self->{'Parent'}->find_prop($prop); }
303 0 return undef;
304 }
305
306
307 =head2 $p->add_font($pdf, $font)
308
309 Creates or edits the resource dictionary at this level in the hierarchy. If
310 the font is already supported even through the hierarchy, then it is not added.
311
312 =cut
313
314 sub add_font
315 0 ▶{
Subroutine add_font: not called CC=12 SCAR=50.5
Pod documented
316 0 my ($self, $font, $pdf) = @_;
317 0 my ($name) = $font->{'Name'}->val;
318 0 my ($dict) = $self->find_prop('Resources');
319 0 my ($rdict);
320
321 0 ▶ return $self if ($dict ne "" && defined $dict->{'Font'} && defined $dict->{'Font'}{$name});
Branch: 1 branch
BranchTrueFalseTotal
if $dict ne "" and defined $dict->{"Font"} and defined $dict->{"Font"}{$name} 0 0 0
Condition0%0/6
$dict ne "" and defined $dict->{"Font"} and defined $dict->{"Font"}{$name}
!ll&&!rl&&r
000
$dict ne "" and defined $dict->{"Font"}
!ll&&!rl&&r
000
MC/DC0%0/3
$dict ne "" and defined $dict->{"Font"} and defined $dict->{"Font"}{$name}
$dict ne "" defined $dict->{"Font"} defined $dict->{"Font"}{$name}
Truth table0%0/4
A and B and C
A= $dict ne ""B= defined $dict->{"Font"}C= defined $dict->{"Font"}{$name}
ABCresult
0XX0
10X0
1100
1111
322 0 ▶ unless (defined $self->{'Resources'})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'Resources'}) { } 0 0 0
323 {
324 0 ▶ $dict = $dict ne "" ? $dict->copy($pdf) : PDFDict();
Branch: 1 branch
BranchTrueFalseTotal
$dict ne '' ? : 0 0 0
325 0 $self->{'Resources'} = $dict;
326 }
327 else
328 0 { $dict = $self->{'Resources'}; }
329 0 ▶ $dict->{'Font'} = PDFDict() unless defined $self->{'Resources'}{'Font'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"Resources"}{"Font"} 0 0 0
330 0 $rdict = $dict->{'Font'}->val;
331 0 ▶ $rdict->{$name} = $font unless ($rdict->{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless $rdict->{$name} 0 0 0
332 0 ▶ if (ref $dict ne 'HASH' && $dict->is_obj($pdf))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $dict ne "HASH" and $dict->is_obj($pdf)) 0 0 0
Condition0%0/3
ref $dict ne "HASH" and $dict->is_obj($pdf)
!ll&&!rl&&r
000
MC/DC0%0/2
ref $dict ne "HASH" and $dict->is_obj($pdf)
ref $dict ne "HASH" $dict->is_obj($pdf)
Truth table0%0/3
A and B
A= ref $dict ne "HASH"B= $dict->is_obj($pdf)
ABresult
0X0
100
111
333 0 { $pdf->out_obj($dict); }
334 0 ▶ if (ref $rdict ne 'HASH' && $rdict->is_obj($pdf))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $rdict ne "HASH" and $rdict->is_obj($pdf)) 0 0 0
Condition0%0/3
ref $rdict ne "HASH" and $rdict->is_obj($pdf)
!ll&&!rl&&r
000
MC/DC0%0/2
ref $rdict ne "HASH" and $rdict->is_obj($pdf)
ref $rdict ne "HASH" $rdict->is_obj($pdf)
Truth table0%0/3
A and B
A= ref $rdict ne "HASH"B= $rdict->is_obj($pdf)
ABresult
0X0
100
111
335 0 { $pdf->out_obj($rdict); }
336 0 $self;
337 }
338
339
340 =head2 $p->bbox($xmin, $ymin, $xmax, $ymax, [$param])
341
342 Specifies the bounding box for this and all child pages. If the values are
343 identical to those inherited then no change is made. $param specifies the attribute
344 name so that other 'bounding box'es can be set with this method.
345
346 =cut
347
348 sub bbox
349 0 ▶{
Subroutine bbox: not called CC=7 SCAR=40.3
Pod documented
350 0 my ($self, @bbox) = @_;
351 0 ▶ my ($str) = $bbox[4] || 'MediaBox';
Condition0%0/2
$bbox[4] || 'MediaBox'
l!l
00
MC/DC0%0/1
$bbox[4] || 'MediaBox'
$bbox[4]
Truth table0%0/2
A
A= $bbox[4]
Aresult
11
00
352 0 my ($inh) = $self->find_prop($str);
353 0 my ($test, $i, $e);
354
355 0 ▶ if ($inh ne "")
Branch: 1 branch
BranchTrueFalseTotal
if ($inh ne "") 0 0 0
356 {
357 0 $test = 1; $i = 0;
358 0 foreach $e ($inh->elementsof)
359 0 { $test &= $e->val == $bbox[$i++]; }
360 0 ▶ return $self if $test && $i == 4;
Branch: 1 branch
BranchTrueFalseTotal
if $test and $i == 4 0 0 0
Condition0%0/3
$test and $i == 4
!ll&&!rl&&r
000
MC/DC0%0/2
$test and $i == 4
$test $i == 4
Truth table0%0/3
A and B
A= $testB= $i == 4
ABresult
0X0
100
111
361 }
362
363 0 $inh = PDF::API3::Compat::API2::Basic::PDF::Array->new;
364 0 foreach $e (@bbox[0..3])
365 0 { $inh->add_elements(PDFNum($e)); }
366 0 $self->{$str} = $inh;
367 0 $self;
368 }
369
370
371 =head2 $p->proc_set(@entries)
372
373 Ensures that the current resource contains all the entries in the proc_sets
374 listed. If necessary it creates a local resource dictionary to achieve this.
375
376 =cut
377
378 sub proc_set
379 0 ▶{
Subroutine proc_set: not called CC=10 SCAR=47.0
Pod documented
380 0 my ($self, @entries) = @_;
381 0 my (@temp) = @entries;
382 0 my ($dict, $e);
383
384 0 $dict = $self->find_prop('Resource');
385 0 ▶ if ($dict ne "" && defined $dict->{'ProcSet'})
Branch: 1 branch
BranchTrueFalseTotal
if ($dict ne "" and defined $dict->{"ProcSet"}) 0 0 0
Condition0%0/3
$dict ne "" and defined $dict->{"ProcSet"}
!ll&&!rl&&r
000
MC/DC0%0/2
$dict ne "" and defined $dict->{"ProcSet"}
$dict ne "" defined $dict->{"ProcSet"}
Truth table0%0/3
A and B
A= $dict ne ""B= defined $dict->{"ProcSet"}
ABresult
0X0
100
111
386 {
387 0 foreach $e ($dict->{'ProcSet'}->elementsof)
388 0 { @temp = grep($_ ne $e, @temp); }
389 0 ▶ return $self if (scalar @temp == 0);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @temp == 0 0 0 0
390 0 ▶ @entries = @temp if defined $self->{'Resources'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"Resources"} 0 0 0
391 }
392
393 0 ▶ unless (defined $self->{'Resources'})
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Resources"}) 0 0 0
394 0 ▶ { $self->{'Resources'} = $dict ne "" ? $dict->copy : PDFDict(); }
Branch: 1 branch
BranchTrueFalseTotal
$dict ne '' ? : 0 0 0
395
396 0 ▶ $self->{'Resources'}{'ProcSet'} = PDFArray() unless defined $self->{'ProcSet'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"ProcSet"} 0 0 0
397
398 0 foreach $e (@entries)
399 0 { $self->{'Resources'}{'ProcSet'}->add_elements(PDFName($e)); }
400 0 $self;
401 }
402
403 sub empty
404 0 ▶{
Subroutine empty: not called CC=3 SCAR=24.8
Pod documented
405 0 my ($self) = @_;
406 0 ▶ my ($parent) = $self->{'Parent'} if defined ($self->{'Parent'});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"Parent"} 0 0 0
407
408 0 $self->SUPER::empty;
409 0 ▶ $self->{'Parent'} = $parent if defined $parent;
Branch: 1 branch
BranchTrueFalseTotal
if defined $parent 0 0 0
410 0 $self;
411 }
412
413 sub dont_copy
414 0 ▶{ return $inst{$_[1]} || $_[0]->SUPER::dont_copy($_[1]); }
Subroutine dont_copy: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/3
$PDF::API3::Compat::API2::Basic::PDF::Pages::inst{$_[1]} || $_[0]->SUPER::dont_copy($_[1])
l!l&&r!l&&!r
000
MC/DC0%0/2
$PDF::API3::Compat::API2::Basic::PDF::Pages::inst{$_[1]} || $_[0]->SUPER::dont_copy($_[1])
$PDF::API3::Compat::API2::Basic::PDF::Pages::inst{$_[1]} $_[0]->SUPER::dont_copy($_[1])
Truth table0%0/3
A || B
A= $PDF::API3::Compat::API2::Basic::PDF::Pages::inst{$_[1]}B= $_[0]->SUPER::dont_copy($_[1])
ABresult
1X1
011
000
415
416
417 =head2 $p->get_top
418
419 Returns the top of the pages tree
420
421 =cut
422
423 sub get_top
424 0 ▶{
Subroutine get_top: not called CC=2 SCAR=17.9
Pod documented
425 0 my ($self) = @_;
426 0 my ($p);
427
428 0 ▶ for ($p = $self; defined $p->{'Parent'}; $p = $p->{'Parent'})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p->{"Parent"}) 0 0 0
429 { }
430
431 0 $p->realise;
432 }
433
434 1 1;
435 __END__
« API3/Compat/API2/Outline.pm ↑ Summary API3/Compat/API2/Basic/TTF/GDEF.pm »