Changeset 22639 for main/trunk/greenstone2/perllib/plugins/ExcelPlugin.pm
- Timestamp:
- 2010-08-17T11:46:43+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugins/ExcelPlugin.pm
r22597 r22639 28 28 package ExcelPlugin; 29 29 30 use ConvertBinaryFile;30 use OOConvertBinaryFile; 31 31 use strict; 32 32 no strict 'refs'; # allow filehandles to be variables and viceversa … … 34 34 use gsprintf 'gsprintf'; 35 35 36 # @ISA dynamically configured to be either OpenOfficeConverter or ConvertBinaryFile37 38 # do not initialise these variables39 my $openoffice_ext_installed;40 my $openoffice_ext_working;41 36 sub BEGIN { 42 eval("require OpenOfficeConverter"); 43 if ($@) { 44 # Useful debugging statement if there is a syntax error in OpenOfficeConverter 45 #print STDERR "$@\n"; 46 @ExcelPlugin::ISA = ('ConvertBinaryFile'); 47 $openoffice_ext_installed = 0; 48 $openoffice_ext_working = 0; 49 } 50 else { 51 # Successfully found 52 $openoffice_ext_installed = 1; 53 # now check whether it can run soffice 54 if ($OpenOfficeConverter::openoffice_conversion_available) { 55 @ExcelPlugin::ISA = ('OpenOfficeConverter'); 56 $openoffice_ext_working = 1; 57 58 } else { 59 @ExcelPlugin::ISA = ('ConvertBinaryFile'); 60 $openoffice_ext_working = 0; 61 } 62 } 37 @ExcelPlugin::ISA = ('OOConvertBinaryFile'); 63 38 } 64 39 … … 70 45 'deft' => &get_default_process_exp() } 71 46 ]; 72 73 my $opt_openoffice_args =74 [ { 'name' => "openoffice_scripting",75 'desc' => "{OpenOfficeConverter.openoffice_scripting}",76 'type' => "flag",77 'reqd' => "no" } ];78 79 47 80 48 my $options = { 'name' => "ExcelPlugin", … … 90 58 push(@$pluginlist, $class); 91 59 92 if ($openoffice_ext_installed) {93 print STDERR "ExcelPlugin: OpenOffice Extension to Greenstone detected\n";94 if ($openoffice_ext_working) {95 print STDERR "... and it appears to be working\n";96 } else {97 print STDERR "... but it appears to be broken\n";98 &gsprintf(STDERR, "OpenOfficeConverter: {OpenOfficeConverter.noconversionavailable} ({OpenOfficeConverter.$OpenOfficeConverter::no_openoffice_conversion_reason})\n");99 }100 }101 102 if ($openoffice_ext_working) {103 push(@$arguments,@$opt_openoffice_args);104 }105 106 60 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments}); 107 61 push(@{$hashArgOptLists->{"OptList"}},$options); 108 62 109 my $self = {}; 110 111 if ($openoffice_ext_working) { 112 $self = new OpenOfficeConverter($pluginlist, $inputargs, $hashArgOptLists); 113 } 114 else { 115 $self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 116 } 117 63 my $self = new OOConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 64 118 65 if ($self->{'info_only'}) { 119 66 # don't worry about any options etc … … 131 78 } 132 79 133 $self->{'convert_options'} = "-openoffice_scripting" if $self->{'openoffice_scripting'}; 134 80 $self = bless $self, $class; 135 81 # set convert_to_plugin and convert_to_ext 136 $self->ConvertBinaryFile::set_standard_convert_settings(); 137 print STDERR "final convert-to $self->{'convert_to'}\n"; 82 $self->set_standard_convert_settings(); 138 83 139 84 my $secondary_plugin_name = $self->{'convert_to_plugin'}; … … 151 96 push(@$specific_options, "-processing_tmp_files"); 152 97 } 153 154 $self = bless $self, $class;155 98 156 99 $self->load_secondary_plugins($class,$secondary_plugin_options,$hashArgOptLists); 157 return bless$self;100 return $self; 158 101 } 102 159 103 160 104 sub convert_post_process_old
Note:
See TracChangeset
for help on using the changeset viewer.