Changeset 22611

Show
Ignore:
Timestamp:
12.08.2010 15:58:39 (9 years ago)
Author:
kjdon
Message:

now uses OpenOfficeConverter? that is not ConvertBinaryFile?

Files:
1 modified

Legend:

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

    r22597 r22611  
    4242    if ($@) { 
    4343    # 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'); 
    4646    $openoffice_ext_installed = 0; 
    4747    $openoffice_ext_working = 0; 
     
    5252    # now check whether it can run soffice 
    5353    if ($OpenOfficeConverter::openoffice_conversion_available) { 
    54         @WordPlugin::ISA = ('OpenOfficeConverter'); 
     54        #@WordPlugin::ISA = ('OpenOfficeConverter'); 
    5555        $openoffice_ext_working = 1; 
    5656         
    5757    } else { 
    58         @WordPlugin::ISA = ('ConvertBinaryFile'); 
     58        #@WordPlugin::ISA = ('ConvertBinaryFile'); 
    5959        $openoffice_ext_working = 0; 
    6060    } 
     61    } 
     62 
     63    if ($openoffice_ext_working) { 
     64    @WordPlugin::ISA = ('ConvertBinaryFile', 'OpenOfficeConverter'); 
     65    } else { 
     66    @WordPlugin::ISA = ('ConvertBinaryFile'); 
    6167    } 
    6268} 
     
    160166 
    161167    my $self = {}; 
    162  
    163168    if ($openoffice_ext_working) { 
    164169     
    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); 
    166174    } 
    167175    else { 
    168176    $self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 
    169     } 
     177   } 
    170178 
    171179    if ($self->{'info_only'}) { 
     
    203211    }  
    204212 
     213    $self = bless $self, $class; 
     214    # if we use the merge inheritance above, need to bless self before calling a method. 
    205215    # set convert_to_plugin and convert_to_ext 
    206     $self->ConvertBinaryFile::set_standard_convert_settings(); 
     216    $self->set_standard_convert_settings(); 
    207217  
    208218    my $secondary_plugin_name = $self->{'convert_to_plugin'}; 
     
    253263    } 
    254264 
    255     $self = bless $self, $class; 
     265    #$self = bless $self, $class; 
    256266    $self->load_secondary_plugins($class,$secondary_plugin_options,$hashArgOptLists); 
    257267 
     
    264274     
    265275    $self->SUPER::init($verbosity,$outhandle,$failhandle); 
     276    if ($openoffice_ext_working) { 
     277    $self->OpenOfficeConverter::init(); 
     278    } 
    266279} 
    267280 
     
    270283    my ($self) = @_; 
    271284     
     285    if ($openoffice_ext_working) { 
     286    $self->OpenOfficeConverter::deinit(); 
     287    } 
    272288    $self->SUPER::deinit(); 
    273289} 
     
    281297} 
    282298 
     299# if we are using open office, we use OpenOfficeConverter's convert method, otherwise fall back to ConvertBinaryFile method. 
     300sub 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} 
    283318sub convert_post_process_old 
    284319{