Index: /main/trunk/greenstone2/perllib/plugins/WordPlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/WordPlugin.pm	(revision 22640)
+++ /main/trunk/greenstone2/perllib/plugins/WordPlugin.pm	(revision 22641)
@@ -25,5 +25,5 @@
 package WordPlugin;
 
-use ConvertBinaryFile;
+use OOConvertBinaryFile;
 
 
@@ -33,37 +33,6 @@
 use gsprintf 'gsprintf';
 
-# @ISA dynamically configured to be either OpenOfficeConverter or ConvertBinaryFile
-
-# do not initialise these variables
-my $openoffice_ext_installed;
-my $openoffice_ext_working;
 sub BEGIN {
-    eval("require OpenOfficeConverter");
-    if ($@) {
-	# Useful debugging statement if there is a syntax error in OpenOfficeConverter:
-	print STDERR "$@\n";
-	#@WordPlugin::ISA = ('ConvertBinaryFile');
-	$openoffice_ext_installed = 0;
-	$openoffice_ext_working = 0;
-    }
-    else {
-	# Successfully found
-	$openoffice_ext_installed = 1;
-	# now check whether it can run soffice
-	if ($OpenOfficeConverter::openoffice_conversion_available) {
-	    #@WordPlugin::ISA = ('OpenOfficeConverter');
-	    $openoffice_ext_working = 1;
-	    
-	} else {
-	    #@WordPlugin::ISA = ('ConvertBinaryFile');
-	    $openoffice_ext_working = 0;
-	}
-    }
-
-    if ($openoffice_ext_working) {
-	@WordPlugin::ISA = ('ConvertBinaryFile', 'OpenOfficeConverter');
-    } else {
-	@WordPlugin::ISA = ('ConvertBinaryFile');
-    }
+    @WordPlugin::ISA = ('OOConvertBinaryFile');
 }
 
@@ -85,10 +54,4 @@
 			   'reqd' => "no" } ];
 
-my $opt_openoffice_args = 
-    [ { 'name' => "openoffice_scripting",
-	'desc' => "{OpenOfficeConverter.openoffice_scripting}",
-	'type' => "flag",
-	'reqd' => "no" } ];
-
 my $opt_office_args = [ { 'name' => "metadata_fields",
 			  'desc' => "{WordPlugin.metadata_fields}",
@@ -138,14 +101,4 @@
     push(@$pluginlist, $class);
 
-    if ($openoffice_ext_installed) {
-	print STDERR "WordPlugin: OpenOffice Extension to Greenstone detected\n";
-	if ($openoffice_ext_working) {
-	    print STDERR "... and it appears to be working\n";
-	} else {
-	    print STDERR "... but it appears to be broken\n";
-	    &gsprintf(STDERR, "OpenOfficeConverter: {OpenOfficeConverter.noconversionavailable} ({OpenOfficeConverter.$OpenOfficeConverter::no_openoffice_conversion_reason})\n");
-	}
-    }
-    
     my $office_capable = 0;
     if ($ENV{'GSDLOS'} =~ m/^windows$/i) {
@@ -153,6 +106,5 @@
 	$office_capable = 1;
     }
-    if ($openoffice_ext_working) {
-	push(@$arguments,@$opt_openoffice_args);
+    if ($OOConvertBinaryFile::openoffice_ext_working) {
 	$office_capable = 1;
     }
@@ -165,15 +117,5 @@
     push(@{$hashArgOptLists->{"OptList"}},$options);
 
-    my $self = {};
-    if ($openoffice_ext_working) {
-	
-	#$self = new OpenOfficeConverter($pluginlist, $inputargs, $hashArgOptLists);
-	my $ooc_self = new OpenOfficeConverter($pluginlist, $inputargs, $hashArgOptLists);
-	my $cbf_self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
-	$self = BasePlugin::merge_inheritance($ooc_self, $cbf_self);
-    }
-    else {
-	$self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
-   }
+    my $self = new OOConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists);
 
     if ($self->{'info_only'}) {
@@ -195,7 +137,7 @@
 	    print $outhandle "Warning: Cannot have -windows_scripting and -openoffice_scripting\n";
 	    print $outhandle "         on at the same time.  Defaulting to -windows_scripting\n";
+	    $self->{'openoffice_scripting'} = 0;
 	}
 	else {
-	    $self->{'convert_options'} = "-openoffice_scripting";
 	    $self->{'office_scripting'} = 1;
 	}
@@ -211,6 +153,4 @@
     } 
 
-    $self = bless $self, $class;
-    # if we use the merge inheritance above, need to bless self before calling a method.
     # set convert_to_plugin and convert_to_ext
     $self->set_standard_convert_settings();
@@ -263,33 +203,12 @@
     }
 
-    #$self = bless $self, $class;
     $self->load_secondary_plugins($class,$secondary_plugin_options,$hashArgOptLists);
 
-    return bless $self;
-}
-
-sub init {
-    my $self = shift (@_);
-    my ($verbosity, $outhandle, $failhandle) = @_;
-    
-    $self->SUPER::init($verbosity,$outhandle,$failhandle);
-    if ($openoffice_ext_working) {
-	$self->OpenOfficeConverter::init();
-    }
-}
-
-sub deinit {
-    # called only once, after all plugin passes have been done
-    my ($self) = @_;
-    
-    if ($openoffice_ext_working) {
-	$self->OpenOfficeConverter::deinit();
-    }
-    $self->SUPER::deinit();
+    return bless $self, $class;
 }
 
 sub get_default_process_exp {
     my $self = shift (@_);
-    if ($openoffice_ext_working) {
+    if ($OOConvertBinaryFile::openoffice_ext_working) {
 	return q^(?i)\.(doc|dot|docx|odt)$^;
     }
@@ -297,23 +216,4 @@
 }
 
-# if we are using open office, we use OpenOfficeConverter's convert method, otherwise fall back to ConvertBinaryFile method.
-sub tmp_area_convert_file {
-    my $self = shift (@_);
-    my ($output_ext, $input_filename, $textref) = @_;
-
-    if ($openoffice_ext_working && $self->{'openoffice_scripting'}) {
-	my ($result, $result_str, $new_filename) = $self->OpenOfficeConverter::convert($input_filename, $output_ext);
-	if ($result != 0) {
-	    return $new_filename;
-	}
-	my $outhandle=$self->{'outhandle'};
-	print $outhandle "Open Office Conversion error\n";
-	print $outhandle $result_str;
-	return "";
-    }
-    else {
-	return $self->ConvertBinaryFile::tmp_area_convert_file(@_);
-    }
-}
 sub convert_post_process_old
 {
