1 | ###########################################################################
|
---|
2 | #
|
---|
3 | # ExcelPlug.pm -- plugin for importing Microsoft Excel files.
|
---|
4 | # (currently only versions 95 and 97)
|
---|
5 | #
|
---|
6 | # A component of the Greenstone digital library software
|
---|
7 | # from the New Zealand Digital Library Project at the
|
---|
8 | # University of Waikato, New Zealand.
|
---|
9 | #
|
---|
10 | # Copyright (C) 2002 New Zealand Digital Library Project
|
---|
11 | #
|
---|
12 | # This program is free software; you can redistribute it and/or modify
|
---|
13 | # it under the terms of the GNU General Public License as published by
|
---|
14 | # the Free Software Foundation; either version 2 of the License, or
|
---|
15 | # (at your option) any later version.
|
---|
16 | #
|
---|
17 | # This program is distributed in the hope that it will be useful,
|
---|
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | # GNU General Public License for more details.
|
---|
21 | #
|
---|
22 | # You should have received a copy of the GNU General Public License
|
---|
23 | # along with this program; if not, write to the Free Software
|
---|
24 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
25 | #
|
---|
26 | ###########################################################################
|
---|
27 |
|
---|
28 | package ExcelPlug;
|
---|
29 |
|
---|
30 | use ConvertToPlug;
|
---|
31 |
|
---|
32 | sub BEGIN {
|
---|
33 | @ISA = ('ConvertToPlug');
|
---|
34 | }
|
---|
35 |
|
---|
36 | my $arguments =
|
---|
37 | [ { 'name' => "process_exp",
|
---|
38 | 'desc' => "{BasPlug.process_exp}",
|
---|
39 | 'type' => "regexp",
|
---|
40 | 'reqd' => "no",
|
---|
41 | 'deft' => &get_default_process_exp() }
|
---|
42 | ];
|
---|
43 |
|
---|
44 | my $options = { 'name' => "ExcelPlug",
|
---|
45 | 'desc' => "{ExcelPlug.desc}",
|
---|
46 | 'abstract' => "no",
|
---|
47 | 'inherits' => "yes",
|
---|
48 | 'args' => $arguments };
|
---|
49 |
|
---|
50 | sub new {
|
---|
51 | my $class = shift (@_);
|
---|
52 |
|
---|
53 | my $self = new ConvertToPlug ($class, @_);
|
---|
54 | $self->{'plugin_type'} = "ExcelPlug";
|
---|
55 | # I'm not sure what encoding xlhtml produces - I think it puts it
|
---|
56 | # into the Content-Type meta tag in the header of the HTML file.
|
---|
57 |
|
---|
58 | # if ($self->{'input_encoding'} eq "auto") {
|
---|
59 | # $self->{'input_encoding'} = "utf8";
|
---|
60 | # }
|
---|
61 |
|
---|
62 | # 14-05-02 To allow for proper inheritance of arguments - John Thompson
|
---|
63 | my $option_list = $self->{'option_list'};
|
---|
64 | push( @{$option_list}, $options );
|
---|
65 |
|
---|
66 | return bless $self, $class;
|
---|
67 | }
|
---|
68 |
|
---|
69 | sub get_default_process_exp {
|
---|
70 | my $self = shift (@_);
|
---|
71 | return q^(?i)\.xls$^;
|
---|
72 | }
|
---|
73 |
|
---|
74 | sub process {
|
---|
75 | my $self = shift (@_);
|
---|
76 |
|
---|
77 | my $outhandle = $self->{'outhandle'};
|
---|
78 | print $outhandle "ExcelPlug: passing $_[3] on to $self->{'converted_to'}Plug\n"
|
---|
79 | if $self->{'verbosity'} > 1;
|
---|
80 |
|
---|
81 | return ConvertToPlug::process_type($self,"xls",@_);
|
---|
82 | }
|
---|
83 |
|
---|
84 | 1;
|
---|