Changeset 22639

Show
Ignore:
Timestamp:
17.08.2010 11:46:43 (9 years ago)
Author:
kjdon
Message:

now uses new OOConvertBinaryFile as super class

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/ExcelPlugin.pm

    r22597 r22639  
    2828package ExcelPlugin; 
    2929 
    30 use ConvertBinaryFile; 
     30use OOConvertBinaryFile; 
    3131use strict; 
    3232no strict 'refs'; # allow filehandles to be variables and viceversa 
     
    3434use gsprintf 'gsprintf'; 
    3535 
    36 # @ISA dynamically configured to be either OpenOfficeConverter or ConvertBinaryFile 
    37  
    38 # do not initialise these variables 
    39 my $openoffice_ext_installed; 
    40 my $openoffice_ext_working; 
    4136sub 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'); 
    6338} 
    6439 
     
    7045    'deft' => &get_default_process_exp() } 
    7146      ]; 
    72  
    73 my $opt_openoffice_args =  
    74     [ { 'name' => "openoffice_scripting", 
    75     'desc' => "{OpenOfficeConverter.openoffice_scripting}", 
    76     'type' => "flag", 
    77     'reqd' => "no" } ]; 
    78  
    7947 
    8048my $options = { 'name'     => "ExcelPlugin", 
     
    9058    push(@$pluginlist, $class); 
    9159     
    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  
    10660    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments}); 
    10761    push(@{$hashArgOptLists->{"OptList"}},$options); 
    10862 
    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     
    11865    if ($self->{'info_only'}) { 
    11966    # don't worry about any options etc 
     
    13178    } 
    13279 
    133     $self->{'convert_options'} = "-openoffice_scripting" if $self->{'openoffice_scripting'}; 
    134  
     80    $self = bless $self, $class; 
    13581    # 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(); 
    13883 
    13984    my $secondary_plugin_name = $self->{'convert_to_plugin'}; 
     
    15196    push(@$specific_options, "-processing_tmp_files"); 
    15297    } 
    153  
    154     $self = bless $self, $class; 
    15598     
    15699    $self->load_secondary_plugins($class,$secondary_plugin_options,$hashArgOptLists); 
    157     return bless $self;     
     100    return $self;     
    158101} 
     102 
    159103 
    160104sub convert_post_process_old