Changeset 15872 for gsdl/trunk/perllib/plugins/PPTPlugin.pm
- Timestamp:
- 2008-06-05T09:29:32+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/PPTPlugin.pm
r15865 r15872 1 1 ########################################################################### 2 2 # 3 # PPTPlug .pm -- plugin for importing Microsoft PowerPoint files.3 # PPTPlugin.pm -- plugin for importing Microsoft PowerPoint files. 4 4 # (currently only versions 95 and 97) 5 5 # … … 26 26 ########################################################################### 27 27 28 package PPTPlug ;28 package PPTPlugin; 29 29 30 use ConvertToPlug; 30 use ConvertBinaryFile; 31 use ReadTextFile; # for read_file in convert_post_process. do we need it? 32 31 33 use strict; 32 34 no strict 'refs'; # allow filehandles to be variables and viceversa 33 35 34 36 sub BEGIN { 35 @PPTPlug ::ISA = ('ConvertToPlug');37 @PPTPlugin::ISA = ('ConvertBinaryFile', 'ReadTextFile'); 36 38 } 37 39 38 40 my $convert_to_list = 39 41 [ { 'name' => "auto", 40 'desc' => "{Convert ToPlug.convert_to.auto}" },42 'desc' => "{ConvertBinaryFile.convert_to.auto}" }, 41 43 { 'name' => "html", 42 'desc' => "{Convert ToPlug.convert_to.html}" },44 'desc' => "{ConvertBinaryFile.convert_to.html}" }, 43 45 { 'name' => "text", 44 'desc' => "{Convert ToPlug.convert_to.text}" },46 'desc' => "{ConvertBinaryFile.convert_to.text}" }, 45 47 { 'name' => "pagedimg_jpg", 46 'desc' => "{Convert ToPlug.convert_to.pagedimg_jpg}" },48 'desc' => "{ConvertBinaryFile.convert_to.pagedimg_jpg}" }, 47 49 { 'name' => "pagedimg_gif", 48 'desc' => "{Convert ToPlug.convert_to.pagedimg_gif}" },50 'desc' => "{ConvertBinaryFile.convert_to.pagedimg_gif}" }, 49 51 { 'name' => "pagedimg_png", 50 'desc' => "{Convert ToPlug.convert_to.pagedimg_png}" }52 'desc' => "{ConvertBinaryFile.convert_to.pagedimg_png}" } 51 53 ]; 52 54 53 55 my $arguments = 54 56 [ { 'name' => "process_exp", 55 'desc' => "{Bas Plug.process_exp}",57 'desc' => "{BasePlugin.process_exp}", 56 58 'type' => "regexp", 57 59 'reqd' => "no", … … 59 61 ]; 60 62 61 my $options = { 'name' => "PPTPlug ",62 'desc' => "{PPTPlug .desc}",63 my $options = { 'name' => "PPTPlugin", 64 'desc' => "{PPTPlugin.desc}", 63 65 'abstract' => "no", 64 66 'inherits' => "yes", … … 73 75 if ($ENV{'GSDLOS'} =~ m/^windows$/i) { 74 76 my $ws_arg =[{ 'name' => "convert_to", 75 'desc' => "{Convert ToPlug.convert_to}",77 'desc' => "{ConvertBinaryFile.convert_to}", 76 78 'type' => "enum", 77 79 'reqd' => "yes", … … 79 81 'deft' => "html" }, 80 82 { 'name' => "windows_scripting", 81 'desc' => "{PPTPlug .windows_scripting}",83 'desc' => "{PPTPlugin.windows_scripting}", 82 84 'type' => "flag", 83 85 'reqd' => "no" } … … 86 88 } 87 89 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); 90 92 91 93 92 my @arg_array = @$inputargs; 93 my $self = new ConvertToPlug($pluginlist, $inputargs, $hashArgOptLists); 94 my $self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 94 95 95 96 if ($self->{'info_only'}) { … … 98 99 } 99 100 101 $self->{'filename_extension'} = "ppt"; 102 $self->{'file_type'} = "PPT"; 103 100 104 # ppthtml outputs utf-8 already. 101 #these are passed through to gsConvert.pl by Convert ToPlug.pm105 #these are passed through to gsConvert.pl by ConvertBinaryFile.pm 102 106 $self->{'convert_options'} = "-windows_scripting" if $self->{'windows_scripting'}; 103 107 my $secondary_plugin_options = $self->{'secondary_plugin_options'}; 104 108 105 109 if ($self->{'windows_scripting'} && ($self->{'convert_to'} eq "PagedImg")) { 106 $secondary_plugin_options->{'PagedIm gPlug'} = [];110 $secondary_plugin_options->{'PagedImagePlugin'} = []; 107 111 } else { 108 $secondary_plugin_options->{'HTMLPlug '} = [];112 $secondary_plugin_options->{'HTMLPlugin'} = []; 109 113 } 110 my $html_options = $secondary_plugin_options->{'HTMLPlug '};111 my $pageimg_options = $secondary_plugin_options->{'PagedIm gPlug'};114 my $html_options = $secondary_plugin_options->{'HTMLPlugin'}; 115 my $pageimg_options = $secondary_plugin_options->{'PagedImagePlugin'}; 112 116 113 117 if ($self->{'input_encoding'} eq "auto") { 114 118 $self->{'input_encoding'} = "utf8"; 115 if (defined $secondary_plugin_options->{'HTMLPlug '}){119 if (defined $secondary_plugin_options->{'HTMLPlugin'}){ 116 120 push(@$html_options,"-input_encoding", "utf8"); 117 121 push(@$html_options,"-extract_language") if $self->{'extract_language'}; 118 122 119 # Instruct HTMLPlug (when eventually accessed through read_into_doc_obj)123 # Instruct HTMLPlugin (when eventually accessed through read_into_doc_obj) 120 124 # to extract these metadata fields from the HEAD META fields 121 125 push(@$html_options,"-metadata_fields","Title,GENERATOR,date,author<Creator>"); 122 126 } 123 if (defined $secondary_plugin_options->{'PagedIm gPlug'}){127 if (defined $secondary_plugin_options->{'PagedImagePlugin'}){ 124 128 push(@$pageimg_options,"-input_encoding", "utf8"); 125 129 push(@$pageimg_options,"-extract_language") if $self->{'extract_language'}; … … 138 142 } 139 143 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... 146 145 sub convert_post_process 147 146 { … … 161 160 } 162 161 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 }169 162 170 163 1;
Note:
See TracChangeset
for help on using the changeset viewer.