a
    Jb                     @   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__ 0lib/python3.9/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 ]}| | q6d 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   B   s    
zCustom._write_propertiesc                 C   s   d}|\}}}|  j d7  _ d|fd| j fd|fg}| d| |dkrT| | nF|dkrh| | n2|d	kr|| | n|d
kr| | n
| | | d d S )Nz&{D5CDD505-2E9C-101B-9397-08002B2CF9AE}r   fmtidr   namepropertyZ
number_intZ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   S   s$    

zCustom._write_propertyc                 C   s   |  d| d S )Nz	vt:lpwstrZ_xml_data_elementr	   r"   r   r   r   r!   u   s    zCustom._write_vt_lpwstrc                 C   s   |  d| d S )Nzvt:filetimer#   r$   r   r   r   r   y   s    zCustom._write_vt_filetimec                 C   s   |  d| d S )Nzvt:i4r#   r$   r   r   r   r   }   s    zCustom._write_vt_i4c                 C   s   |  d| d S )Nzvt:r8r#   r$   r   r   r   r      s    zCustom._write_vt_r8c                 C   s   |r
d}nd}|  d| d S )NtrueZ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   