o
    öÑÐbÍ  ã                   @   s"   d dl mZ G dd„ dejƒZdS )é   )Ú	xmlwriterc                       sh   e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Z‡  ZS )ÚCustomzM
    A class for writing the Excel XLSX Custom Workbook Property file.


    c                    s   t t| ƒ ¡  g | _d| _dS )z
        Constructor.

        r   N)Úsuperr   Ú__init__Ú
propertiesÚpid©Úself©Ú	__class__© úP/var/www/secure340b-portal/env/lib/python3.10/site-packages/xlsxwriter/custom.pyr      s   
zCustom.__init__c                 C   s
   || _ d S )N)r   )r	   r   r   r   r   Ú_set_properties$   s   
zCustom._set_propertiesc                 C   s&   |   ¡  |  ¡  |  d¡ |  ¡  d S )NÚ
Properties)Z_xml_declarationÚ_write_propertiesÚ_xml_end_tagZ
_xml_closer   r   r   r   Ú_assemble_xml_file.   s   
zCustom._assemble_xml_filec                 C   sJ   d}|d }|d }d|fd|fg}|   d|¡ | jD ]}|  |¡ qd S )Nz6http://schemas.openxmlformats.org/officeDocument/2006/zcustom-propertiesZdocPropsVTypesÚxmlnszxmlns:vtr   )Ú_xml_start_tagr   Ú_write_property)r	   Zschemar   Zxmlns_vtÚ
attributesÚcustom_propertyr   r   r   r   A   s   þ
þzCustom._write_propertiesc                 C   s¨   d}|\}}}|  j d7  _ d|fd| j fd|fg}|  d|¡ |dkr*|  |¡ n#|dkr4|  |¡ n|d	kr>|  |¡ n|d
krH|  |¡ n|  |¡ |  d¡ d S )Nz&{D5CDD505-2E9C-101B-9397-08002B2CF9AE}r   Úfmtidr   ÚnameÚpropertyZ
number_intÚnumberÚdateÚbool)r   r   Ú_write_vt_i4Ú_write_vt_r8Ú_write_vt_filetimeÚ_write_vt_boolÚ_write_vt_lpwstrr   )r	   r   r   r   ÚvalueZproperty_typer   r   r   r   r   R   s$   
ý
zCustom._write_propertyc                 C   ó   |   d|¡ d S )Nz	vt:lpwstr©Z_xml_data_element©r	   r#   r   r   r   r"   t   ó   zCustom._write_vt_lpwstrc                 C   r$   )Nzvt:filetimer%   r&   r   r   r   r    x   r'   zCustom._write_vt_filetimec                 C   r$   )Nzvt:i4r%   r&   r   r   r   r   |   r'   zCustom._write_vt_i4c                 C   r$   )Nzvt:r8r%   r&   r   r   r   r   €   r'   zCustom._write_vt_r8c                 C   s   |rd}nd}|   d|¡ d S )NÚtrueÚfalsezvt:boolr%   r&   r   r   r   r!   „   s   zCustom._write_vt_bool)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r"   r    r   r   r!   Ú__classcell__r   r   r
   r   r      s    
"r   N)Ú r   Z	XMLwriterr   r   r   r   r   Ú<module>   s   