Commit 1c3f3819 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support Apache OpenOffice 4.

parent 74b11d36
...@@ -35,9 +35,9 @@ from base64 import decodestring, encodestring ...@@ -35,9 +35,9 @@ from base64 import decodestring, encodestring
from getopt import getopt, GetoptError from getopt import getopt, GetoptError
try: try:
unicode basestring
except NameError: except NameError:
unicode = str basestring = str
__doc__ = """ __doc__ = """
...@@ -196,9 +196,9 @@ class UnoConverter(object): ...@@ -196,9 +196,9 @@ class UnoConverter(object):
continue continue
property_value = getattr(container, property_name, '') property_value = getattr(container, property_name, '')
if property_value: if property_value:
if isinstance(property_value, unicode): if isinstance(property_value, basestring):
metadata[property_name] = property_value metadata[property_name] = property_value
elif isinstance(property_value, tuple) and isinstance(property_value[0], unicode): elif isinstance(property_value, tuple) and isinstance(property_value[0], basestring):
metadata[property_name] = property_value metadata[property_name] = property_value
else: else:
try: try:
...@@ -241,7 +241,7 @@ class UnoConverter(object): ...@@ -241,7 +241,7 @@ class UnoConverter(object):
else: else:
new_properties.append([prop, value]) new_properties.append([prop, value])
for prop, value in new_properties: for prop, value in new_properties:
if isinstance(value, unicode): if isinstance(value, basestring):
user_defined_properties.addProperty(prop, 0, '') user_defined_properties.addProperty(prop, 0, '')
user_defined_properties.setPropertyValue(prop, value) user_defined_properties.setPropertyValue(prop, value)
self.document_loaded.store() self.document_loaded.store()
......
...@@ -35,6 +35,11 @@ except ImportError: ...@@ -35,6 +35,11 @@ except ImportError:
import helper_util import helper_util
from getopt import getopt, GetoptError from getopt import getopt, GetoptError
try:
basestring
except NameError:
basestring = str
__doc__ = """ __doc__ = """
usage: unomimemapper [options] usage: unomimemapper [options]
...@@ -71,7 +76,7 @@ class UnoMimemapper(object): ...@@ -71,7 +76,7 @@ class UnoMimemapper(object):
for obj in iter(element_list): for obj in iter(element_list):
if obj.Name in ignore_name_list: if obj.Name in ignore_name_list:
continue continue
if not isinstance(obj.Value, (bool, int, str, tuple)): if not isinstance(obj.Value, (bool, int, basestring, tuple)):
continue continue
element_dict[obj.Name] = obj.Value element_dict[obj.Name] = obj.Value
service_dict[name] = element_dict service_dict[name] = element_dict
......
...@@ -98,14 +98,18 @@ class MimeMapper(object): ...@@ -98,14 +98,18 @@ class MimeMapper(object):
ooo_disable_filter_name_list -- a list of filter names which are disabled ooo_disable_filter_name_list -- a list of filter names which are disabled
""" """
alternative_extension_dict = { alternative_extension_dict = {
'Microsoft Excel 2007 XML':'ms.xlsx',
'Microsoft Excel 2007/2010 XML':'ms.xlsx', 'Microsoft Excel 2007/2010 XML':'ms.xlsx',
'Microsoft Excel 2007/2010/2013 XML':'ms.xlsx', 'Microsoft Excel 2007/2010/2013 XML':'ms.xlsx',
'Microsoft Excel 5.0':'5.xls', 'Microsoft Excel 5.0':'5.xls',
'Microsoft Excel 95':'95.xls', 'Microsoft Excel 95':'95.xls',
'Microsoft PowerPoint 2007 XML AutoPlay':'ms.ppsx',
'Microsoft PowerPoint 2007/2010 XML AutoPlay':'ms.ppsx', 'Microsoft PowerPoint 2007/2010 XML AutoPlay':'ms.ppsx',
'Microsoft PowerPoint 2007/2010/2013 XML AutoPlay':'ms.ppsx', 'Microsoft PowerPoint 2007/2010/2013 XML AutoPlay':'ms.ppsx',
'Microsoft PowerPoint 2007 XML':'ms.pptx',
'Microsoft PowerPoint 2007/2010 XML':'ms.pptx', 'Microsoft PowerPoint 2007/2010 XML':'ms.pptx',
'Microsoft PowerPoint 2007/2010/2013 XML':'ms.pptx', 'Microsoft PowerPoint 2007/2010/2013 XML':'ms.pptx',
'Microsoft Word 2007 XML':'ms.docx',
'Microsoft Word 2007/2010 XML':'ms.docx', 'Microsoft Word 2007/2010 XML':'ms.docx',
'Microsoft Word 2007/2010/2013 XML':'ms.docx', 'Microsoft Word 2007/2010/2013 XML':'ms.docx',
'Microsoft Word 6.0':'6.doc', 'Microsoft Word 6.0':'6.doc',
......
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