file2xliff4j
Class OOoTextImporter

java.lang.Object
  extended by file2xliff4j.OdfImporter
      extended by file2xliff4j.OOoTextImporter
All Implemented Interfaces:
Converter
Direct Known Subclasses:
ExcelImporter, PPTImporter, RTFImporter, WordImporter

public class OOoTextImporter
extends OdfImporter
implements Converter

The OOoTextImporter is used to import OpenOffice.org Text (odt) documents, converting them to XLIFF.

Author:
Weldon Whipple <weldon@lingotek.com>

Field Summary
 
Fields inherited from interface file2xliff4j.Converter
BLKSIZE, formatSuffix, skeletonSuffix, startXliff, stylesTSkeletonSuffix, tSkeletonSuffix, xliffSuffix, xmlDeclaration
 
Constructor Summary
OOoTextImporter()
          Constructor for the OpenOffice.org Text importer
 
Method Summary
 ConversionStatus convert(ConversionMode mode, java.util.Locale language, java.lang.String phaseName, int maxPhase, java.nio.charset.Charset nativeEncoding, FileType nativeFileType, java.lang.String nativeFileName, java.lang.String baseDir, Notifier notifier)
          Deprecated. 
 ConversionStatus convert(ConversionMode mode, java.util.Locale language, java.lang.String phaseName, int maxPhase, java.nio.charset.Charset nativeEncoding, FileType nativeFileType, java.lang.String nativeFileName, java.lang.String baseDir, Notifier notifier, SegmentBoundary boundary, java.io.StringWriter generatedFileName)
          Convert an OpenOffice.org text (odt), spreadsheet (ods), or presentations (odp) file to XLIFF, creating xliff, skeleton and format files as output.
 ConversionStatus convert(ConversionMode mode, java.util.Locale language, java.lang.String phaseName, int maxPhase, java.nio.charset.Charset nativeEncoding, FileType nativeFileType, java.lang.String nativeFileName, java.lang.String baseDir, Notifier notifier, SegmentBoundary boundary, java.io.StringWriter generatedFileName, java.util.Set<f2xutils.XMLTuXPath> skipList)
          Convert an OpenOffice.org text (odt) file to XLIFF, creating xliff, skeleton and format files as output.
 java.lang.Object getConversionProperty(java.lang.String property)
          Return an object representing a format-specific (and converter-specific) property.
 FileType getFileType()
          Return the file type that this converter handles.
 void setConversionProperty(java.lang.String property, java.lang.Object value)
          Set a format-specific property that might affect the way that the conversion occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OOoTextImporter

public OOoTextImporter()
Constructor for the OpenOffice.org Text importer

Method Detail

convert

public ConversionStatus convert(ConversionMode mode,
                                java.util.Locale language,
                                java.lang.String phaseName,
                                int maxPhase,
                                java.nio.charset.Charset nativeEncoding,
                                FileType nativeFileType,
                                java.lang.String nativeFileName,
                                java.lang.String baseDir,
                                Notifier notifier,
                                SegmentBoundary boundary,
                                java.io.StringWriter generatedFileName)
                         throws ConversionException
Convert an OpenOffice.org text (odt), spreadsheet (ods), or presentations (odp) file to XLIFF, creating xliff, skeleton and format files as output.

In the present implementation, the OOoTextImporter extracts the content.xml file from the input ODT file, then calls upon its superclass (OdfImporter) to complete the conversion to XLIFF.

Specified by:
convert in interface Converter
Overrides:
convert in class OdfImporter
Parameters:
mode - The mode of conversion (to or from XLIFF).
language - The language of the input file.
phaseName - The target phase-name. This value is ignored.
maxPhase - The maximum phase number. This value is ignored.
nativeEncoding - The encoding of the input file. This parameter is ignored for OpenOffice.org text files.
nativeFileType - The type of the original native file. This parameter provides the value for the datatype attribute of the XLIFF's file element. If this importer is converting an intermediate file that began as (say) a Word file, the value should indicate the type of the original file ("WORD" for Word files).
nativeFileName - The name of the input file. (It will likely be a file whose filename ends in ".odt")
baseDir - The directory that contains the input odt file--from which we will read the input file. This is also the directory in which the output xliff, skeleton and format files (and any other intermediate or temporary files) will be written.
notifier - Instance of a class that implements the Notifier interface (to send notifications in case of conversion error).
boundary - The boundary on which to segment translation units (e.g., on paragraph or sentence boundaries)
generatedFileName - If non-null, the converter will write the name of the file (without parent directories) to which the generated XLIFF file was written.
Returns:
Indicator of the status of the conversion.
Throws:
ConversionException - If a conversion exception is encountered.

convert

public ConversionStatus convert(ConversionMode mode,
                                java.util.Locale language,
                                java.lang.String phaseName,
                                int maxPhase,
                                java.nio.charset.Charset nativeEncoding,
                                FileType nativeFileType,
                                java.lang.String nativeFileName,
                                java.lang.String baseDir,
                                Notifier notifier,
                                SegmentBoundary boundary,
                                java.io.StringWriter generatedFileName,
                                java.util.Set<f2xutils.XMLTuXPath> skipList)
                         throws ConversionException
Convert an OpenOffice.org text (odt) file to XLIFF, creating xliff, skeleton and format files as output.

In the present implementation, the OOoTextImporter extracts the content.xml file from the input ODT file, then calls upon its superclass (OdfImporter) to complete the conversion to XLIFF.

Specified by:
convert in interface Converter
Overrides:
convert in class OdfImporter
Parameters:
mode - The mode of conversion (to or from XLIFF).
language - The language of the input file.
phaseName - The target phase-name. This value is ignored.
maxPhase - The maximum phase number. This value is ignored.
nativeEncoding - The encoding of the input file. This parameter is ignored for OpenOffice.org text files.
nativeFileType - The type of the original native file. This parameter provides the value for the datatype attribute of the XLIFF's file element. If this importer is converting an intermediate file that began as (say) a Word file, the value should indicate the type of the original file ("WORD" for Word files).
nativeFileName - The name of the input file. (It will likely be a file whose filename ends in ".odt")
baseDir - The directory that contains the input odt file--from which we will read the input file. This is also the directory in which the output xliff, skeleton and format files (and any other intermediate or temporary files) will be written.
notifier - Instance of a class that implements the Notifier interface (to send notifications in case of conversion error).
boundary - The boundary on which to segment translation units (e.g., on paragraph or sentence boundaries)
generatedFileName - If non-null, the converter will write the name of the file (without parent directories) to which the generated XLIFF file was written.
skipList - (Not used by this converter.)
Returns:
Indicator of the status of the conversion.
Throws:
ConversionException - If a conversion exception is encountered.

convert

@Deprecated
public ConversionStatus convert(ConversionMode mode,
                                           java.util.Locale language,
                                           java.lang.String phaseName,
                                           int maxPhase,
                                           java.nio.charset.Charset nativeEncoding,
                                           FileType nativeFileType,
                                           java.lang.String nativeFileName,
                                           java.lang.String baseDir,
                                           Notifier notifier)
                         throws ConversionException
Deprecated. 

Convert an OpenOffice.org text (odt) file to XLIFF, creating xliff, skeleton and format files as output.

In the present implementation, the OOoTextImporter extracts the content.xml file from the input ODT file, then calls upon its superclass (OdfImporter) to complete the conversion to XLIFF.

Specified by:
convert in interface Converter
Overrides:
convert in class OdfImporter
Parameters:
mode - The mode of conversion (to or from XLIFF).
language - The language of the input file.
phaseName - The target phase-name. This value is ignored.
maxPhase - The maximum phase number. This value is ignored.
nativeEncoding - The encoding of the input file. This parameter is ignored for OpenOffice.org text files.
nativeFileType - The type of the original native file. This parameter provides the value for the datatype attribute of the XLIFF's file element. If this importer is converting an intermediate file that began as (say) a Word file, the value should indicate the type of the original file ("WORD" for Word files).
nativeFileName - The name of the input file. (It will likely be a file whose filename ends in ".odt")
baseDir - The directory that contains the input odt file--from which we will read the input file. This is also the directory in which the output xliff, skeleton and format files (and any other intermediate or temporary files) will be written.
notifier - Instance of a class that implements the Notifier interface (to send notifications in case of conversion error).
Returns:
Indicator of the status of the conversion.
Throws:
ConversionException - If a conversion exception is encountered.

getConversionProperty

public java.lang.Object getConversionProperty(java.lang.String property)
Return an object representing a format-specific (and converter-specific) property.

Specified by:
getConversionProperty in interface Converter
Parameters:
property - The name of the property to return.
Returns:
An Object that represents the property's value.

getFileType

public FileType getFileType()
Return the file type that this converter handles. (For importers, this means the file type that it imports to XLIFF; for exporters, it is the file type that ie exports to (from XLIFF).

Specified by:
getFileType in interface Converter
Returns:
the ODT file type.

setConversionProperty

public void setConversionProperty(java.lang.String property,
                                  java.lang.Object value)
                           throws ConversionException
Set a format-specific property that might affect the way that the conversion occurs.

Note: This converter needs no format-specific properties. If any are passed, they will be silently ignored.

Specified by:
setConversionProperty in interface Converter
Parameters:
property - The name of the property
value - The value of the property
Throws:
ConversionException - If the property isn't recognized (and if it matters).