Commit | Line | Data |
d0eafc11 |
1 | package Excel::Template::TextObject; |
2 | |
3 | use strict; |
4 | |
5 | BEGIN { |
6 | use vars qw(@ISA); |
7 | @ISA = qw(Excel::Template::Base); |
8 | |
9 | use Excel::Template::Base; |
10 | |
a8441e01 |
11 | UNI_YES use Unicode::String; |
d0eafc11 |
12 | } |
13 | |
14 | # This is a helper object. It is not instantiated by the user, |
15 | # nor does it represent an XML object. Rather, certain elements, |
16 | # such as <textbox>, can use this object to do text with variable |
17 | # substitutions. |
18 | |
19 | sub new |
20 | { |
21 | my $class = shift; |
22 | my $self = $class->SUPER::new(@_); |
23 | |
24 | $self->{STACK} = [] unless UNIVERSAL::isa($self->{STACK}, 'ARRAY'); |
25 | |
26 | return $self; |
27 | } |
28 | |
29 | sub resolve |
30 | { |
31 | my $self = shift; |
32 | my ($context) = @_; |
33 | |
a8441e01 |
34 | UNI_YES my $t = Unicode::String::utf8(''); |
35 | UNI_NO my $t = ''; |
d0eafc11 |
36 | |
37 | for my $tok (@{$self->{STACK}}) |
38 | { |
39 | my $val = $tok; |
40 | $val = $val->resolve($context) |
37513eae |
41 | if Excel::Template::Factory::is_embedded( $val ); |
d0eafc11 |
42 | |
a8441e01 |
43 | UNI_YES $t .= Unicode::String::utf8("$val"); |
44 | UNI_NO $t .= $val; |
d0eafc11 |
45 | } |
46 | |
47 | return $t; |
48 | } |
49 | |
50 | 1; |
51 | __END__ |
52 | |
53 | =head1 NAME |
54 | |
55 | Excel::Template::TextObject |
56 | |
57 | =head1 PURPOSE |
58 | |
59 | =head1 NODE NAME |
60 | |
61 | =head1 INHERITANCE |
62 | |
63 | =head1 ATTRIBUTES |
64 | |
65 | =head1 CHILDREN |
66 | |
67 | =head1 AFFECTS |
68 | |
69 | =head1 DEPENDENCIES |
70 | |
71 | =head1 USAGE |
72 | |
73 | =head1 AUTHOR |
74 | |
c09684ff |
75 | Rob Kinyon (rob.kinyon@gmail.com) |
d0eafc11 |
76 | |
77 | =head1 SEE ALSO |
78 | |
79 | =cut |