Changeset 22609 for gs2-extensions/open-office-src/trunk
- Timestamp:
- 2010-08-12T15:55:23+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/open-office-src/trunk/perllib/plugins/OpenOfficeConverter.pm
r22508 r22609 41 41 42 42 BEGIN { 43 @OpenOfficeConverter::ISA = (' ConvertBinaryFile', 'BaseMediaConverter');43 @OpenOfficeConverter::ISA = ('BaseMediaConverter'); 44 44 45 45 # Check that OpenOffice and jodconverter are installed and available on 46 46 # the path 47 48 47 $openoffice_conversion_available = 1; 49 48 $no_openoffice_conversion_reason = ""; … … 55 54 else { 56 55 my $gextoo_home = $ENV{'GEXT_OPENOFFICE'}; 57 my $jodjar = &util::filename_cat($gextoo_home,"lib","java","jodconverter .jar");56 my $jodjar = &util::filename_cat($gextoo_home,"lib","java","jodconverterx.jar"); 58 57 59 58 if (!-e $jodjar) { … … 109 108 push(@{$hashArgOptLists->{"OptList"}},$options); 110 109 111 my $bmc_self = new BaseMediaConverter($pluginlist, $inputargs, $hashArgOptLists,1); 112 my $cbf_self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 113 my $self = BasePlugin::merge_inheritance($bmc_self,$cbf_self); 110 my $self = new BaseMediaConverter($pluginlist, $inputargs, $hashArgOptLists); 114 111 115 112 if ($self->{'info_only'}) { … … 130 127 my $outhandle = $self->{'outhandle'}; 131 128 &gsprintf($outhandle, "OpenOfficeConverter: {OpenOfficeConverter.noconversionavailable} ({OpenOfficeConverter.$no_openoffice_conversion_reason})\n"); 132 &gsprintf($outhandle, "OpenOfficeConverter {OpenOfficeConverter.ConvertBinaryFileDefault}\n");133 129 } 134 130 … … 143 139 my ($verbosity, $outhandle, $failhandle) = @_; 144 140 145 $self->ConvertBinaryFile::init($verbosity,$outhandle,$failhandle);146 147 141 $self->{'ootmp_file_paths'} = (); 148 142 } … … 151 145 my $self = shift(@_); 152 146 153 $self->ConvertBinaryFile::deinit(@_);154 155 147 $self->clean_up_temporary_files(); 156 148 } 157 149 158 150 159 160 161 151 sub convert { 152 my $self = shift(@_); 153 my ($source_file_full_path, $target_file_type) = @_; 154 155 return 0 unless $openoffice_conversion_available; 156 # check the filename 157 return 0 if ( !-f $source_file_full_path); 158 159 my $source_file_no_path = &File::Basename::basename($source_file_full_path); 160 # Determine the full name and path of the output file 161 my $target_file_path; 162 if ($self->{'enable_cache'}) { 163 $self->init_cache_for_file($source_file_full_path); 164 my $cache_dir = $self->{'cached_dir'}; 165 my $file_root = $self->{'cached_file_root'}; 166 #$file_root .= "_$convert_id" if ($convert_id ne ""); 167 my $target_file = "$file_root.$target_file_type"; 168 $target_file_path = &util::filename_cat($cache_dir,$target_file); 169 } 170 else { 171 # this is in gsdl/tmp. get a tmp filename in collection instead??? 172 $target_file_path = &util::get_tmp_filename($target_file_type); 173 push(@{$self->{'ootmp_file_paths'}}, $target_file_path); 174 } 175 176 # Generate and run the convert command 177 my $convert_command = "oo2html \"$source_file_full_path\" \"$target_file_path\""; 178 print STDERR "convert_command = $convert_command\n"; 179 my $print_info = { 'message_prefix' => "OpenOffice Conversion", 180 'message' => "Converting $source_file_no_path to: $target_file_type" }; 181 #$print_info->{'cache_mode'} = $cache_mode if ($cache_mode ne ""); 182 183 my ($regenerated,$result,$had_error) 184 = $self->autorun_general_cmd($convert_command,$source_file_full_path, $target_file_path,$print_info); 185 if ($had_error) { 186 return (0, $result,$target_file_path); 187 } 188 return (1, $result,$target_file_path); 189 } 190 191 192 193 sub convert_orig { 162 194 my $self = shift(@_); 163 195 my $source_file_path = shift(@_);
Note:
See TracChangeset
for help on using the changeset viewer.