37a7839fa2bbcbfae246cd79217288be3ff2cc51
[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 render
13 {
14     my $self = shift;
15     my ($context) = @_;
16
17     $context->new_worksheet( $self );
18
19     my $password = $context->get( $self, 'PROTECT' );
20     if (defined $password)
21     {
22         $context->active_worksheet->protect( $password );
23     }
24
25     return $self->SUPER::render($context);
26 }
27
28 1;
29 __END__
30
31 =head1 NAME
32
33 Excel::Template::Container::Worksheet - Excel::Template::Container::Worksheet
34
35 =head1 PURPOSE
36
37 To provide a new worksheet.
38
39 =head1 NODE NAME
40
41 WORKSHEET
42
43 =head1 INHERITANCE
44
45 Excel::Template::Container
46
47 =head1 ATTRIBUTES
48
49 =over 4
50
51 =item * NAME
52
53 This is the name of the worksheet to be added.
54
55 =item * PROTECT
56
57 If the attribute exists, it will mark the worksheet as being protected. Whatever
58 value is set will be used as the password.
59
60 This activates the HIDDEN and LOCKED nodes.
61
62 =back
63
64 =head1 CHILDREN
65
66 None
67
68 =head1 EFFECTS
69
70 None
71
72 =head1 DEPENDENCIES
73
74 None
75
76 =head1 USAGE
77
78   <worksheet name="My Taxes">
79     ... Children here
80   </worksheet>
81
82 In the above example, the children will be executed in the context of the
83 "My Taxes" worksheet.
84
85 =head1 AUTHOR
86
87 Rob Kinyon (rob.kinyon@gmail.com)
88
89 =head1 SEE ALSO
90
91 ROW, CELL, FORMULA
92
93 =cut