Ignore:
Timestamp:
2008-06-05T09:29:32+12:00 (16 years ago)
Author:
kjdon
Message:

plugin overhaul: plugins renamed to xxPlugin, and in some cases the names are made more sensible. They now use the new base plugins. Hopefully we have better code reuse. Some of the plugins still need work done as I didn't want to spend another month doing this before committing it. Alos, I haven't really tested anything yet...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/PPTPlugin.pm

    r15865 r15872  
    11###########################################################################
    22#
    3 # PPTPlug.pm -- plugin for importing Microsoft PowerPoint files.
     3# PPTPlugin.pm -- plugin for importing Microsoft PowerPoint files.
    44#  (currently only versions 95 and 97)
    55#
     
    2626###########################################################################
    2727
    28 package PPTPlug;
     28package PPTPlugin;
    2929
    30 use ConvertToPlug;
     30use ConvertBinaryFile;
     31use ReadTextFile; # for read_file in convert_post_process. do we need it?
     32
    3133use strict;
    3234no strict 'refs'; # allow filehandles to be variables and viceversa
    3335
    3436sub BEGIN {
    35     @PPTPlug::ISA = ('ConvertToPlug');
     37    @PPTPlugin::ISA = ('ConvertBinaryFile', 'ReadTextFile');
    3638}
    3739
    3840my $convert_to_list =
    3941    [ { 'name' => "auto",
    40     'desc' => "{ConvertToPlug.convert_to.auto}" },
     42    'desc' => "{ConvertBinaryFile.convert_to.auto}" },
    4143      { 'name' => "html",
    42     'desc' => "{ConvertToPlug.convert_to.html}" },
     44    'desc' => "{ConvertBinaryFile.convert_to.html}" },
    4345      { 'name' => "text",
    44     'desc' => "{ConvertToPlug.convert_to.text}" },
     46    'desc' => "{ConvertBinaryFile.convert_to.text}" },
    4547      { 'name' => "pagedimg_jpg",
    46     'desc' => "{ConvertToPlug.convert_to.pagedimg_jpg}" },
     48    'desc' => "{ConvertBinaryFile.convert_to.pagedimg_jpg}" },
    4749      { 'name' => "pagedimg_gif",
    48     'desc' => "{ConvertToPlug.convert_to.pagedimg_gif}" },
     50    'desc' => "{ConvertBinaryFile.convert_to.pagedimg_gif}" },
    4951      { 'name' => "pagedimg_png",
    50     'desc' => "{ConvertToPlug.convert_to.pagedimg_png}" }
     52    'desc' => "{ConvertBinaryFile.convert_to.pagedimg_png}" }
    5153      ];
    5254
    5355my $arguments =
    5456    [ { 'name' => "process_exp",
    55     'desc' => "{BasPlug.process_exp}",
     57    'desc' => "{BasePlugin.process_exp}",
    5658    'type' => "regexp",
    5759    'reqd' => "no",
     
    5961      ];
    6062
    61 my $options = { 'name'     => "PPTPlug",
    62         'desc'     => "{PPTPlug.desc}",
     63my $options = { 'name'     => "PPTPlugin",
     64        'desc'     => "{PPTPlugin.desc}",
    6365        'abstract' => "no",
    6466        'inherits' => "yes",
     
    7375    if ($ENV{'GSDLOS'} =~ m/^windows$/i) {
    7476    my $ws_arg =[{ 'name' => "convert_to",
    75                'desc' => "{ConvertToPlug.convert_to}",
     77               'desc' => "{ConvertBinaryFile.convert_to}",
    7678               'type' => "enum",
    7779               'reqd' => "yes",
     
    7981               'deft' => "html" },
    8082             { 'name' => "windows_scripting",
    81                'desc' => "{PPTPlug.windows_scripting}",
     83               'desc' => "{PPTPlugin.windows_scripting}",
    8284               'type' => "flag",
    8385               'reqd' => "no" }
     
    8688    }
    8789   
    88     if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
    89     if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     90    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
     91    push(@{$hashArgOptLists->{"OptList"}},$options);
    9092
    9193
    92     my @arg_array = @$inputargs;
    93     my $self = new ConvertToPlug($pluginlist, $inputargs, $hashArgOptLists);
     94    my $self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
    9495 
    9596    if ($self->{'info_only'}) {
     
    9899    }
    99100
     101    $self->{'filename_extension'} = "ppt";
     102    $self->{'file_type'} = "PPT";
     103
    100104    # ppthtml outputs utf-8 already.
    101     #these are passed through to gsConvert.pl by ConvertToPlug.pm
     105    #these are passed through to gsConvert.pl by ConvertBinaryFile.pm
    102106    $self->{'convert_options'} = "-windows_scripting" if $self->{'windows_scripting'};
    103107    my $secondary_plugin_options = $self->{'secondary_plugin_options'};
    104108
    105109    if ($self->{'windows_scripting'} && ($self->{'convert_to'} eq "PagedImg")) {
    106     $secondary_plugin_options->{'PagedImgPlug'} = [];
     110    $secondary_plugin_options->{'PagedImagePlugin'} = [];
    107111    } else {
    108     $secondary_plugin_options->{'HTMLPlug'} = [];
     112    $secondary_plugin_options->{'HTMLPlugin'} = [];
    109113    }
    110     my $html_options = $secondary_plugin_options->{'HTMLPlug'};
    111     my $pageimg_options = $secondary_plugin_options->{'PagedImgPlug'};
     114    my $html_options = $secondary_plugin_options->{'HTMLPlugin'};
     115    my $pageimg_options = $secondary_plugin_options->{'PagedImagePlugin'};
    112116
    113117    if ($self->{'input_encoding'} eq "auto") {
    114118    $self->{'input_encoding'} = "utf8";
    115     if (defined $secondary_plugin_options->{'HTMLPlug'}){
     119    if (defined $secondary_plugin_options->{'HTMLPlugin'}){
    116120        push(@$html_options,"-input_encoding", "utf8");
    117121        push(@$html_options,"-extract_language") if $self->{'extract_language'};
    118122
    119         # Instruct HTMLPlug (when eventually accessed through read_into_doc_obj)
     123        # Instruct HTMLPlugin (when eventually accessed through read_into_doc_obj)
    120124        # to extract these metadata fields from the HEAD META fields
    121125        push(@$html_options,"-metadata_fields","Title,GENERATOR,date,author<Creator>");
    122126    }
    123     if (defined $secondary_plugin_options->{'PagedImgPlug'}){
     127    if (defined $secondary_plugin_options->{'PagedImagePlugin'}){
    124128        push(@$pageimg_options,"-input_encoding", "utf8");
    125129        push(@$pageimg_options,"-extract_language") if $self->{'extract_language'};
     
    138142}
    139143
    140 sub get_file_type {
    141     my $self = shift (@_);
    142     my $file_type = "PPT";
    143     return $file_type;
    144 }
    145 
     144# do we need this? above states that ppthtml produces utf8 text...
    146145sub convert_post_process
    147146{
     
    161160}
    162161
    163 sub process {
    164     my $self = shift (@_);
    165     my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
    166 
    167     return $self->process_type("ppt",$base_dir,$file,$doc_obj);
    168 }
    169162
    1701631;
Note: See TracChangeset for help on using the changeset viewer.