Added more tests for conditionals. Need to fix linking in POD. - Intermediate commit!
[p5sagit/Excel-Template.git] / lib / Excel / Template / Container / Worksheet.pm
1 package Excel::Template::Container::Worksheet;
2
3 use strict;
4
5 BEGIN {
6     use vars qw(@ISA);
7     @ISA = qw(Excel::Template::Container);
8
9     use Excel::Template::Container;
10 }
11
12 sub exit_scope  { $_[1]->active_worksheet( undef ) }
13
14 sub render
15 {
16     my $self = shift;
17     my ($context) = @_;
18
19     my $worksheet = $context->new_worksheet( $self );
20
21     my $password = $context->get( $self, 'PROTECT' );
22     if (defined $password)
23     {
24         $worksheet->protect( $password );
25     }
26
27     $worksheet->keep_leading_zeros( 1 )
28         if $context->mark( 'keep_leading_zeros' );
29
30     return $self->SUPER::render($context);
31 }
32
33 1;
34 __END__
35
36 =head1 NAME
37
38 Excel::Template::Container::Worksheet - Excel::Template::Container::Worksheet
39
40 =head1 PURPOSE
41
42 To provide a new worksheet.
43
44 =head1 NODE NAME
45
46 WORKSHEET
47
48 =head1 INHERITANCE
49
50 Excel::Template::Container
51
52 =head1 ATTRIBUTES
53
54 =over 4
55
56 =item * NAME
57
58 This is the name of the worksheet to be added.
59
60 =item * PROTECT
61
62 If the attribute exists, it will mark the worksheet as being protected. Whatever
63 value is set will be used as the password.
64
65 This activates the HIDDEN and LOCKED nodes.
66
67 =item * KEEP_LEADING_ZEROS
68
69 This will change the behavior of the worksheet to preserve leading zeros.
70
71 =back
72
73 =head1 CHILDREN
74
75 None
76
77 =head1 EFFECTS
78
79 None
80
81 =head1 DEPENDENCIES
82
83 None
84
85 =head1 USAGE
86
87   <worksheet name="My Taxes">
88     ... Children here
89   </worksheet>
90
91 In the above example, the children will be executed in the context of the
92 "My Taxes" worksheet.
93
94 =head1 AUTHOR
95
96 Rob Kinyon (rob.kinyon@gmail.com)
97
98 =head1 SEE ALSO
99
100 ROW, CELL, FORMULA
101
102 =cut