o
    ûÐ,h  ã                   @   s2   d dl mZmZ ddlmZ G dd„ dejƒZdS )é    )ÚListÚTupleé   )Ú	xmlwriterc                       sª   e Zd ZdZ‡ fdd„Zdeeeeef  fdd„Zdd„ Z	d	d
„ Z
deeeef fdd„Zdefdd„Zdefdd„Zdefdd„Zdefdd„Zdefdd„Z‡  ZS )ÚCustomzM
    A class for writing the Excel XLSX Custom Workbook Property file.


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

        r   N)ÚsuperÚ__init__Ú
propertiesÚpid©Úself©Ú	__class__© úG/var/www/html/rh/venv/lib/python3.10/site-packages/xlsxwriter/custom.pyr      s   

zCustom.__init__r	   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)Ú_xml_declarationÚ_write_propertiesÚ_xml_end_tagÚ
_xml_closer   r   r   r   Ú_assemble_xml_file2   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-propertiesÚdocPropsVTypesÚxmlnszxmlns:vtr   )Ú_xml_start_tagr	   Ú_write_property)r   Úschemar   Úxmlns_vtÚ
attributesÚcustom_propertyr   r   r   r   E   s   þ
þzCustom._write_propertiesr   c                 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ÚpropertyÚ
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!   ÚvalueÚproperty_typer   r   r   r   r   V   s$   
ý
zCustom._write_propertyr,   c                 C   ó   |   d|¡ d S )Nz	vt:lpwstr©Ú_xml_data_element©r   r,   r   r   r   r+   x   ó   zCustom._write_vt_lpwstrc                 C   r.   )Nzvt:filetimer/   r1   r   r   r   r)   |   r2   zCustom._write_vt_filetimec                 C   r.   )Nzvt:i4r/   r1   r   r   r   r'   €   r2   zCustom._write_vt_i4c                 C   r.   )Nzvt:r8r/   r1   r   r   r   r(   „   r2   zCustom._write_vt_r8c                 C   r.   )Nzvt:boolr/   r1   r   r   r   r*   ˆ   r2   zCustom._write_vt_bool)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Ústrr   r   r   r   r+   r)   r'   r(   r*   Ú__classcell__r   r   r   r   r      s    
"r   N)Útypingr   r   Ú r   Ú	XMLwriterr   r   r   r   r   Ú<module>   s   
