Changeset 22508


Ignore:
Timestamp:
2010-07-26T15:44:03+12:00 (14 years ago)
Author:
kjdon
Message:

some moving around and tidying up of code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/open-office/trunk/perllib/plugins/OpenOfficeConverter.pm

    r22506 r22508  
    3535use gsprintf 'gsprintf';
    3636
     37# these two variables mustn't be initialised here or they will get stuck
     38# at those values.
     39our $openoffice_conversion_available;
     40our $no_openoffice_conversion_reason;
     41
    3742BEGIN {
    3843    @OpenOfficeConverter::ISA = ('ConvertBinaryFile', 'BaseMediaConverter');
    39 }
    40 
    41 my $arguments = [ ];
    42 
    43 my $opt_arguments = [
    44     { 'name' => "openoffice_port",
    45       'desc' => "{OpenOfficeConverter.openoffice_port}",
    46       'type' => "int",
    47       'deft' => "8100",
    48       'range' => "81,",
    49       'reqd' => "no" },
    50     ];
    51 
    52 my $options = { 'name' => "OpenOfficeConverter",
    53         'desc' => "{OpenOfficeConverter.desc}",
    54         'abstract' => "yes",
    55         'inherits' => "yes",
    56         'args' => $arguments };
    57 
    58 sub new {
    59     my ($class) = shift (@_);
    60     my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
    61     push(@$pluginlist, $class);
    62 
    6344
    6445    # Check that OpenOffice and jodconverter are installed and available on
    6546    # the path
    6647
    67     my $openoffice_conversion_available = 1;
    68     my $no_openoffice_conversion_reason = "";
     48    $openoffice_conversion_available = 1;
     49    $no_openoffice_conversion_reason = "";
    6950   
    7051    if (! defined $ENV{'GEXT_OPENOFFICE'}) {
     
    9172        }
    9273        }
    93 
    9474        my $cmd = "soffice -headless 2>&1";
    9575
     
    10484    }
    10585
    106     if ($openoffice_conversion_available) {
    107     push(@$arguments,@$opt_arguments);
    108     }
     86}
     87
     88my $arguments = [
     89    { 'name' => "openoffice_port",
     90      'desc' => "{OpenOfficeConverter.openoffice_port}",
     91      'type' => "int",
     92      'deft' => "8100",
     93      'range' => "81,",
     94      'reqd' => "no" },
     95    ];
     96
     97my $options = { 'name' => "OpenOfficeConverter",
     98        'desc' => "{OpenOfficeConverter.desc}",
     99        'abstract' => "yes",
     100        'inherits' => "yes",
     101        'args' => $arguments };
     102
     103sub new {
     104    my ($class) = shift (@_);
     105    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     106    push(@$pluginlist, $class);
    109107
    110108    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
     
    113111    my $bmc_self = new BaseMediaConverter($pluginlist, $inputargs, $hashArgOptLists,1);
    114112    my $cbf_self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
    115 
    116113    my $self = BasePlugin::merge_inheritance($bmc_self,$cbf_self);
    117114
     115    if ($self->{'info_only'}) {
     116    # don't worry about any options etc
     117    return bless $self, $class;
     118    }
    118119    if ($openoffice_conversion_available) {
    119120    my $oo_port = $self->{'openoffice_port'};
     
    129130    my $outhandle = $self->{'outhandle'};
    130131    &gsprintf($outhandle, "OpenOfficeConverter: {OpenOfficeConverter.noconversionavailable} ({OpenOfficeConverter.$no_openoffice_conversion_reason})\n");
     132    &gsprintf($outhandle, "OpenOfficeConverter {OpenOfficeConverter.ConvertBinaryFileDefault}\n");
    131133    } 
    132134
Note: See TracChangeset for help on using the changeset viewer.