| 1 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | package Document::OOXML::Part; | ||
| 3 | 2 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | # ABSTRACT: Role for OOXML document parts | ||
| 7 | |||
| 8 | |||
| 9 | 2 | requires 'to_string'; | |
| 10 | |||
| 11 | 2 | has part_name => ( | |
| 12 | is => 'ro', | ||
| 13 | isa => 'Str', | ||
| 14 | required => 1, | ||
| 15 | ); | ||
| 16 | |||
| 17 | 2 | has document => ( | |
| 18 | is => 'rw', | ||
| 19 | isa => 'Document::OOXML::Document', | ||
| 20 | weak_ref => 1, | ||
| 21 | ); | ||
| 22 | |||
| 23 | 24 | ▶ | sub get_relations_part { |
|
Subroutine
get_relations_part: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 24 | 24 | my $self = shift; | |
| 25 | 24 | my $type = shift; | |
| 26 | 24 | my $id = shift; | |
| 27 | |||
| 28 | 24 | my $rels = $self->document->get_rels_for_part($self->part_name); | |
| 29 | |||
| 30 | 24 | return $rels; | |
| 31 | } | ||
| 32 | |||
| 33 | 16 | ▶ | sub find_referenced_part_by_id { |
|
Subroutine
find_referenced_part_by_id: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 34 | 16 | my $self = shift; | |
| 35 | 16 | my $id = shift; | |
| 36 | |||
| 37 | 16 | my $rels = $self->get_relations_part; | |
| 38 | 16 | my $data = $rels->get_part_relation_by_id($id); | |
| 39 | |||
| 40 | 16 | return $self->document->get_part($data->{part_name}); | |
| 41 | } | ||
| 42 | |||
| 43 | 8 | ▶ | sub find_referenced_part_by_type { |
|
Subroutine
find_referenced_part_by_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 44 | 8 | my $self = shift; | |
| 45 | 8 | my $type = shift; | |
| 46 | |||
| 47 | 8 | my $rels = $self->get_relations_part; | |
| 48 | 8 | my $data = $rels->get_part_relation_by_type($type); | |
| 49 | |||
| 50 | 8 | return $self->document->get_part($data->{part_name}); | |
| 51 | } | ||
| 52 | |||
| 53 | 2 | 1; | |
| 54 | |||
| 55 | __END__ | ||