##############################################################################
#
# Copyright (c) 2002 Ingeniweb SARL
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################

"""
AttachmentField product
"""

import AttachmentHandler

import os
import os.path
import string
import re
import sys


if sys.platform == "win32":
    program = "xlhtml.exe"
else:
    program = "xlhtml"


class MSExcelAttachment(AttachmentHandler.AbstractHandler):
    """
    MSExcelAttachment file abstraction
    """
    icon_file = "excel.gif"
    small_icon_file = "excel_small.gif"
    content_types = ('application/excel', 'application/x-excel', 'application/excel', 'application/x-msexcel', 'application/vnd.ms-excel', )
    converter_type = "MSExcel"

    index_path = program
    index_arguments = r"%s"
    index_encoding = ("CP1252", "utf8", )
    
    preview_path = program
    preview_arguments = r"-nh %s"
    preview_format = "html"
    preview_encoding = ("CP1252", "utf8", )


AttachmentHandler.registerHandler(MSExcelAttachment)
