Commit 42fb4ec9 authored by Boris Kocherov's avatar Boris Kocherov

x2t: getAllowedConversionFormatList return OnlyOffice types too

1
parent d1edf0f2
......@@ -204,17 +204,25 @@ class Handler(object):
...
]
"""
get_format_list = OOoHandler.getAllowedConversionFormatList
source_mimetype = parseContentType(source_mimetype).gettype()
if source_mimetype in ("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"):
return [("application/x-asc-text", "OnlyOffice Text Document")]
if source_mimetype in ("docy", "application/x-asc-text"):
return [("application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Word 2007 Document")]
if source_mimetype in ("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"):
return [("application/x-asc-spreadsheet", "OnlyOffice Spreadsheet")]
return get_format_list("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
if source_mimetype in ("xlsy", "application/x-asc-spreadsheet"):
return [("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Excel 2007 Spreadsheet")]
if source_mimetype in ("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"):
return [("application/x-asc-presentation", "OnlyOffice Presentation")]
return get_format_list("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
if source_mimetype in ("ppty", "application/x-asc-presentation"):
return [("application/vnd.openxmlformats-officedocument.presentationml.presentation", "PowerPoint 2007 Presentation")]
return []
return get_format_list("application/vnd.openxmlformats-officedocument.presentationml.presentation")
format_list = get_format_list(source_mimetype)
format_list_append = format_list.append
for f_type, _ in format_list:
if f_type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
format_list_append(("application/x-asc-text", "OnlyOffice Text Document"))
break
if f_type == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
format_list_append(("application/x-asc-spreadsheet", "OnlyOffice Spreadsheet"))
break
if f_type == "application/vnd.openxmlformats-officedocument.presentationml.presentation":
format_list_append(("application/x-asc-presentation", "OnlyOffice Presentation"))
break
return format_list
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment