Changeset 22611
- Timestamp:
- 2010-08-12T15:58:39+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugins/WordPlugin.pm
r22597 r22611 42 42 if ($@) { 43 43 # Useful debugging statement if there is a syntax error in OpenOfficeConverter: 44 #print STDERR "$@\n";45 @WordPlugin::ISA = ('ConvertBinaryFile');44 print STDERR "$@\n"; 45 #@WordPlugin::ISA = ('ConvertBinaryFile'); 46 46 $openoffice_ext_installed = 0; 47 47 $openoffice_ext_working = 0; … … 52 52 # now check whether it can run soffice 53 53 if ($OpenOfficeConverter::openoffice_conversion_available) { 54 @WordPlugin::ISA = ('OpenOfficeConverter');54 #@WordPlugin::ISA = ('OpenOfficeConverter'); 55 55 $openoffice_ext_working = 1; 56 56 57 57 } else { 58 @WordPlugin::ISA = ('ConvertBinaryFile');58 #@WordPlugin::ISA = ('ConvertBinaryFile'); 59 59 $openoffice_ext_working = 0; 60 60 } 61 } 62 63 if ($openoffice_ext_working) { 64 @WordPlugin::ISA = ('ConvertBinaryFile', 'OpenOfficeConverter'); 65 } else { 66 @WordPlugin::ISA = ('ConvertBinaryFile'); 61 67 } 62 68 } … … 160 166 161 167 my $self = {}; 162 163 168 if ($openoffice_ext_working) { 164 169 165 $self = new OpenOfficeConverter($pluginlist, $inputargs, $hashArgOptLists); 170 #$self = new OpenOfficeConverter($pluginlist, $inputargs, $hashArgOptLists); 171 my $ooc_self = new OpenOfficeConverter($pluginlist, $inputargs, $hashArgOptLists); 172 my $cbf_self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 173 $self = BasePlugin::merge_inheritance($ooc_self, $cbf_self); 166 174 } 167 175 else { 168 176 $self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 169 177 } 170 178 171 179 if ($self->{'info_only'}) { … … 203 211 } 204 212 213 $self = bless $self, $class; 214 # if we use the merge inheritance above, need to bless self before calling a method. 205 215 # set convert_to_plugin and convert_to_ext 206 $self-> ConvertBinaryFile::set_standard_convert_settings();216 $self->set_standard_convert_settings(); 207 217 208 218 my $secondary_plugin_name = $self->{'convert_to_plugin'}; … … 253 263 } 254 264 255 $self = bless $self, $class;265 #$self = bless $self, $class; 256 266 $self->load_secondary_plugins($class,$secondary_plugin_options,$hashArgOptLists); 257 267 … … 264 274 265 275 $self->SUPER::init($verbosity,$outhandle,$failhandle); 276 if ($openoffice_ext_working) { 277 $self->OpenOfficeConverter::init(); 278 } 266 279 } 267 280 … … 270 283 my ($self) = @_; 271 284 285 if ($openoffice_ext_working) { 286 $self->OpenOfficeConverter::deinit(); 287 } 272 288 $self->SUPER::deinit(); 273 289 } … … 281 297 } 282 298 299 # if we are using open office, we use OpenOfficeConverter's convert method, otherwise fall back to ConvertBinaryFile method. 300 sub tmp_area_convert_file { 301 my $self = shift (@_); 302 my ($output_ext, $input_filename, $textref) = @_; 303 304 if ($openoffice_ext_working && $self->{'openoffice_scripting'}) { 305 my ($result, $result_str, $new_filename) = $self->OpenOfficeConverter::convert($input_filename, $output_ext); 306 if ($result != 0) { 307 return $new_filename; 308 } 309 my $outhandle=$self->{'outhandle'}; 310 print $outhandle "Open Office Conversion error\n"; 311 print $outhandle $result_str; 312 return ""; 313 } 314 else { 315 return $self->ConvertBinaryFile::tmp_area_convert_file(@_); 316 } 317 } 283 318 sub convert_post_process_old 284 319 {
Note:
See TracChangeset
for help on using the changeset viewer.