use of org.artofsolving.jodconverter.document.DocumentFormat in project xwiki-platform by xwiki.
the class DefaultOfficeResourceViewer method isPresentation.
/**
* Utility method for checking if a file name corresponds to an office presentation.
*
* @param fileName attachment file name
* @return {@code true} if the file extension represents an office presentation format, {@code false} otherwise
*/
private boolean isPresentation(String fileName) {
String extension = fileName.substring(fileName.lastIndexOf('.') + 1);
OfficeConverter officeConverter = this.officeServer.getConverter();
if (officeConverter != null) {
DocumentFormat format = officeConverter.getFormatRegistry().getFormatByExtension(extension);
return format != null && format.getInputFamily() == DocumentFamily.PRESENTATION;
}
return false;
}
use of org.artofsolving.jodconverter.document.DocumentFormat in project xwiki-platform by xwiki.
the class OfficeImporterScriptService method isPresentation.
/**
* Utility method for checking if a file name corresponds to an office presentation.
*
* @param officeFileName office file name
* @return true if the file name / extension represents an office presentation format
*/
private boolean isPresentation(String officeFileName) {
String extension = officeFileName.substring(officeFileName.lastIndexOf('.') + 1);
OfficeConverter officeConverter = officeServer.getConverter();
if (officeConverter != null) {
DocumentFormat format = officeConverter.getFormatRegistry().getFormatByExtension(extension);
return format != null && format.getInputFamily() == DocumentFamily.PRESENTATION;
}
return false;
}
use of org.artofsolving.jodconverter.document.DocumentFormat in project xwiki-platform by xwiki.
the class DefaultOfficeViewerScriptService method isConversionSupported.
/**
* Use this method to check if the unidirectional conversion from a document format (input media type) to another
* document format (output media type) is supported by this converter.
*
* @param inputMediaType the media type of the input document
* @param outputMediaType the media type of the output document
* @return {@code true} if a document can be converted from the input media type to the output media type,
* {@code false} otherwise
*/
private boolean isConversionSupported(String inputMediaType, String outputMediaType) {
OfficeConverter converter = this.officeServer.getConverter();
if (converter != null) {
DocumentFormat inputFormat = converter.getFormatRegistry().getFormatByMediaType(inputMediaType);
DocumentFormat outputFormat = converter.getFormatRegistry().getFormatByMediaType(outputMediaType);
return inputFormat != null && outputFormat != null && outputFormat.getStoreProperties(inputFormat.getInputFamily()) != null;
} else {
return false;
}
}
Aggregations