~ubuntu-branches/ubuntu/gutsy/horae/gutsy

« back to all changes in this revision

Viewing changes to 0CPAN/Spreadsheet-WriteExcel-2.15/lib/Spreadsheet/WriteExcel/Chart.pm

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2006-12-28 12:36:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061228123648-9xnjr76wfthd92cq
Tags: 064-1
New upstream release, dropped dependency on libtk-filedialog-perl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package Spreadsheet::WriteExcel::Chart;
2
 
 
3
 
###############################################################################
4
 
#
5
 
# Chart - A writer class for Excel Charts.
6
 
#
7
 
#
8
 
# Used in conjunction with Spreadsheet::WriteExcel
9
 
#
10
 
# Copyright 2000-2005, John McNamara, jmcnamara@cpan.org
11
 
#
12
 
# Documentation after __END__
13
 
#
14
 
 
15
 
use Exporter;
16
 
use strict;
17
 
use Carp;
18
 
use FileHandle;
19
 
use Spreadsheet::WriteExcel::BIFFwriter;
20
 
 
21
 
 
22
 
 
23
 
 
24
 
use vars qw($VERSION @ISA);
25
 
@ISA = qw(Spreadsheet::WriteExcel::BIFFwriter);
26
 
 
27
 
$VERSION = '2.13';
28
 
 
29
 
###############################################################################
30
 
#
31
 
# new()
32
 
#
33
 
# Constructor. Creates a new Chart object from a BIFFwriter object
34
 
#
35
 
sub new {
36
 
 
37
 
    my $class                   = shift;
38
 
    my $self                    = Spreadsheet::WriteExcel::BIFFwriter->new();
39
 
 
40
 
    $self->{_filename}          = $_[0];
41
 
    $self->{_name}              = $_[1];
42
 
    $self->{_index}             = $_[2];
43
 
    $self->{_encoding}          = $_[3];
44
 
    $self->{_activesheet}       = $_[4];
45
 
    $self->{_firstsheet}        = $_[5];
46
 
 
47
 
    $self->{_type}              = 0x0200;
48
 
    $self->{_ext_sheets}        = [];
49
 
    $self->{_using_tmpfile}     = 1;
50
 
    $self->{_filehandle}        = "";
51
 
    $self->{_fileclosed}        = 0;
52
 
    $self->{_offset}            = 0;
53
 
    $self->{_xls_rowmax}        = 0;
54
 
    $self->{_xls_colmax}        = 0;
55
 
    $self->{_xls_strmax}        = 0;
56
 
    $self->{_dim_rowmin}        = 0;
57
 
    $self->{_dim_rowmax}        = 0;
58
 
    $self->{_dim_colmin}        = 0;
59
 
    $self->{_dim_colmax}        = 0;
60
 
    $self->{_dim_changed}       = 0;
61
 
    $self->{_colinfo}           = [];
62
 
    $self->{_selection}         = [0, 0];
63
 
    $self->{_panes}             = [];
64
 
    $self->{_active_pane}       = 3;
65
 
    $self->{_frozen}            = 0;
66
 
    $self->{_selected}          = 0;
67
 
    $self->{_hidden}            = 0;
68
 
 
69
 
    $self->{_paper_size}        = 0x0;
70
 
    $self->{_orientation}       = 0x1;
71
 
    $self->{_header}            = '';
72
 
    $self->{_footer}            = '';
73
 
    $self->{_hcenter}           = 0;
74
 
    $self->{_vcenter}           = 0;
75
 
    $self->{_margin_head}       = 0.50;
76
 
    $self->{_margin_foot}       = 0.50;
77
 
    $self->{_margin_left}       = 0.75;
78
 
    $self->{_margin_right}      = 0.75;
79
 
    $self->{_margin_top}        = 1.00;
80
 
    $self->{_margin_bottom}     = 1.00;
81
 
 
82
 
    $self->{_title_rowmin}      = undef;
83
 
    $self->{_title_rowmax}      = undef;
84
 
    $self->{_title_colmin}      = undef;
85
 
    $self->{_title_colmax}      = undef;
86
 
    $self->{_print_rowmin}      = undef;
87
 
    $self->{_print_rowmax}      = undef;
88
 
    $self->{_print_colmin}      = undef;
89
 
    $self->{_print_colmax}      = undef;
90
 
 
91
 
    $self->{_print_gridlines}   = 1;
92
 
    $self->{_screen_gridlines}  = 1;
93
 
    $self->{_print_headers}     = 0;
94
 
 
95
 
    $self->{_fit_page}          = 0;
96
 
    $self->{_fit_width}         = 0;
97
 
    $self->{_fit_height}        = 0;
98
 
 
99
 
    $self->{_hbreaks}           = [];
100
 
    $self->{_vbreaks}           = [];
101
 
 
102
 
    $self->{_protect}           = 0;
103
 
    $self->{_password}          = undef;
104
 
 
105
 
    $self->{_col_sizes}         = {};
106
 
    $self->{_row_sizes}         = {};
107
 
 
108
 
    $self->{_col_formats}       = {};
109
 
    $self->{_row_formats}       = {};
110
 
 
111
 
    $self->{_zoom}              = 100;
112
 
    $self->{_print_scale}       = 100;
113
 
 
114
 
    $self->{_leading_zeros}     = 0;
115
 
 
116
 
    $self->{_outline_row_level} = 0;
117
 
    $self->{_outline_style}     = 0;
118
 
    $self->{_outline_below}     = 1;
119
 
    $self->{_outline_right}     = 1;
120
 
    $self->{_outline_on}        = 1;
121
 
 
122
 
    bless $self, $class;
123
 
    $self->_initialize();
124
 
    return $self;
125
 
}
126
 
 
127
 
 
128
 
###############################################################################
129
 
#
130
 
# _initialize()
131
 
#
132
 
sub _initialize {
133
 
 
134
 
    my $self       = shift;
135
 
    my $filename   = $self->{_filename};
136
 
    my $filehandle = FileHandle->new($filename) or
137
 
                     die "Couldn't open $filename in add_chart_ext(): $!.\n";
138
 
 
139
 
    binmode($filehandle);
140
 
 
141
 
    $self->{_filehandle} = $filehandle;
142
 
    $self->{_datasize}   = -s $filehandle;
143
 
 
144
 
}
145
 
 
146
 
 
147
 
###############################################################################
148
 
#
149
 
# _close()
150
 
#
151
 
# Add data to the beginning of the workbook (note the reverse order)
152
 
# and to the end of the workbook.
153
 
#
154
 
sub _close {
155
 
 
156
 
    my $self = shift;
157
 
}
158
 
 
159
 
 
160
 
###############################################################################
161
 
#
162
 
# get_name().
163
 
#
164
 
# Retrieve the worksheet name.
165
 
#
166
 
sub get_name {
167
 
 
168
 
    my $self    = shift;
169
 
 
170
 
    return $self->{_name};
171
 
}
172
 
 
173
 
 
174
 
###############################################################################
175
 
#
176
 
# get_data().
177
 
#
178
 
# Retrieves data from memory in one chunk, or from disk in $buffer
179
 
# sized chunks.
180
 
#
181
 
sub get_data {
182
 
 
183
 
    my $self   = shift;
184
 
    my $buffer = 4096;
185
 
    my $tmp;
186
 
 
187
 
    return $tmp if read($self->{_filehandle}, $tmp, $buffer);
188
 
 
189
 
    # No data to return
190
 
    return undef;
191
 
}
192
 
 
193
 
 
194
 
###############################################################################
195
 
#
196
 
# select()
197
 
#
198
 
# Set this worksheet as a selected worksheet, i.e. the worksheet has its tab
199
 
# highlighted.
200
 
#
201
 
sub select {
202
 
 
203
 
    my $self = shift;
204
 
 
205
 
    $self->{_hidden}         = 0; # Selected worksheet can't be hidden.
206
 
    $self->{_selected}       = 1;
207
 
}
208
 
 
209
 
 
210
 
###############################################################################
211
 
#
212
 
# activate()
213
 
#
214
 
# Set this worksheet as the active worksheet, i.e. the worksheet that is
215
 
# displayed when the workbook is opened. Also set it as selected.
216
 
#
217
 
sub activate {
218
 
 
219
 
    my $self = shift;
220
 
 
221
 
    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
222
 
    $self->{_selected}       = 1;
223
 
    ${$self->{_activesheet}} = $self->{_index};
224
 
}
225
 
 
226
 
 
227
 
###############################################################################
228
 
#
229
 
# hide()
230
 
#
231
 
# Hide this worksheet.
232
 
#
233
 
sub hide {
234
 
 
235
 
    my $self = shift;
236
 
 
237
 
    $self->{_hidden}         = 1;
238
 
 
239
 
    # A hidden worksheet shouldn't be active or selected.
240
 
    $self->{_selected}       = 0;
241
 
    ${$self->{_activesheet}} = 0;
242
 
    ${$self->{_firstsheet}}  = 0;
243
 
}
244
 
 
245
 
 
246
 
###############################################################################
247
 
#
248
 
# set_first_sheet()
249
 
#
250
 
# Set this worksheet as the first visible sheet. This is necessary
251
 
# when there are a large number of worksheets and the activated
252
 
# worksheet is not visible on the screen.
253
 
#
254
 
sub set_first_sheet {
255
 
 
256
 
    my $self = shift;
257
 
 
258
 
    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
259
 
    ${$self->{_firstsheet}}  = $self->{_index};
260
 
}
261
 
 
262
 
 
263
 
 
264
 
 
265
 
1;
266
 
 
267
 
 
268
 
__END__
269
 
 
270
 
 
271
 
=head1 NAME
272
 
 
273
 
Chart - A writer class for Excel Charts.
274
 
 
275
 
=head1 SYNOPSIS
276
 
 
277
 
See the documentation for Spreadsheet::WriteExcel
278
 
 
279
 
=head1 DESCRIPTION
280
 
 
281
 
This module is used in conjunction with Spreadsheet::WriteExcel.
282
 
 
283
 
=head1 AUTHOR
284
 
 
285
 
John McNamara jmcnamara@cpan.org
286
 
 
287
 
=head1 COPYRIGHT
288
 
 
289
 
� MM-MMV, John McNamara.
290
 
 
291
 
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
292