o
    ûÐ,h   ã                   @   s6   d dl mZmZmZ ddlmZ G dd„ dejƒZdS )é    )ÚDictÚListÚTupleé   )Ú	xmlwriterc                       sþ   e Zd ZdZ‡ fdd„Zdefdd„Zdeeef fdd	„Z	d
e
eef 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edeeeef  fdd„Zdeeef 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‡  ZS )0ÚAppz8
    A class for writing the Excel XLSX App file.


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

        r   N)ÚsuperÚ__init__Ú
part_namesÚheading_pairsÚ
propertiesÚdoc_security©Úself©Ú	__class__© úD/var/www/html/rh/venv/lib/python3.10/site-packages/xlsxwriter/app.pyr	      s
   

zApp.__init__Ú	part_namec                 C   s   | j  |¡ d S ©N)r
   Úappend)r   r   r   r   r   Ú_add_part_name)   ó   zApp._add_part_nameÚheading_pairc                 C   s8   |d sd S | j  d|d f¡ | j  d|d f¡ d S )Nr   Úlpstrr   Úi4)r   r   )r   r   r   r   r   Ú_add_heading_pair-   s   zApp._add_heading_pairr   c                 C   s
   || _ d S r   )r   )r   r   r   r   r   Ú_set_properties8   s   
zApp._set_propertiesc                 C   s†   |   ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  ¡  |  	¡  |  
¡  |  ¡  |  ¡  |  ¡  |  d¡ |  ¡  d S )NÚ
Properties)Ú_xml_declarationÚ_write_propertiesÚ_write_applicationÚ_write_doc_securityÚ_write_scale_cropÚ_write_heading_pairsÚ_write_titles_of_partsÚ_write_managerÚ_write_companyÚ_write_links_up_to_dateÚ_write_shared_docÚ_write_hyperlink_baseÚ_write_hyperlinks_changedÚ_write_app_versionÚ_xml_end_tagÚ
_xml_closer   r   r   r   Ú_assemble_xml_fileB   s    
zApp._assemble_xml_filec                 C   s4   d}|d }|d }d|fd|fg}|   d|¡ d S )Nz6http://schemas.openxmlformats.org/officeDocument/2006/zextended-propertiesÚdocPropsVTypesÚxmlnszxmlns:vtr   )Ú_xml_start_tag)r   Úschemar1   Úxmlns_vtÚ
attributesr   r   r   r    a   s   þzApp._write_propertiesc                 C   ó   |   dd¡ d S )NÚApplicationzMicrosoft Excel©Ú_xml_data_elementr   r   r   r   r!   n   r   zApp._write_applicationc                 C   s   |   d| j¡ d S )NÚDocSecurity)r9   r   r   r   r   r   r"   r   s   zApp._write_doc_securityc                 C   r6   )NÚ	ScaleCropÚfalser8   r   r   r   r   r#   v   r   zApp._write_scale_cropc                 C   s&   |   d¡ |  d| j¡ |  d¡ d S )NÚHeadingPairsÚvariant)r2   Ú_write_vt_vectorr   r-   r   r   r   r   r$   z   s   
zApp._write_heading_pairsc                 C   sB   g }|   d¡ | jD ]	}| d|f¡ q
|  d|¡ |  d¡ d S )NÚTitlesOfPartsr   )r2   r
   r   r?   r-   )r   Ú
parts_datar   r   r   r   r%   €   s   

zApp._write_titles_of_partsÚ	base_typeÚvector_datac                 C   sf   dt |ƒfd|fg}|  d|¡ |D ]}|dkr|  d¡ |  |¡ |dkr+|  d¡ q|  d¡ d S )NÚsizeÚbaseTypez	vt:vectorr>   z
vt:variant)Úlenr2   Ú_write_vt_datar-   )r   rB   rC   r5   Úvt_datar   r   r   r?      s   
þ


€zApp._write_vt_vectorrH   c                 C   s   |   d|d › |d ¡ d S )Nzvt:r   r   r8   )r   rH   r   r   r   rG   ¡   s   zApp._write_vt_datac                 C   s   | j  dd¡}|  d|¡ d S )NÚcompanyÚ ÚCompany©r   Úgetr9   )r   rI   r   r   r   r'   ¥   s   zApp._write_companyc                 C   s$   d| j vrd S |  d| j d ¡ d S )NÚmanagerÚManager)r   r9   r   r   r   r   r&   ª   s   
zApp._write_managerc                 C   r6   )NÚLinksUpToDater<   r8   r   r   r   r   r(   ±   r   zApp._write_links_up_to_datec                 C   r6   )NÚ	SharedDocr<   r8   r   r   r   r   r)   µ   r   zApp._write_shared_docc                 C   s(   | j  d¡}|d u rd S |  d|¡ d S )NÚhyperlink_baseÚHyperlinkBaserL   )r   rR   r   r   r   r*   ¹   s   zApp._write_hyperlink_basec                 C   r6   )NÚHyperlinksChangedr<   r8   r   r   r   r   r+   Â   r   zApp._write_hyperlinks_changedc                 C   r6   )NÚ
AppVersionz12.0000r8   r   r   r   r   r,   Æ   r   zApp._write_app_version)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Ústrr   r   Úintr   r   r   r/   r    r!   r"   r#   r$   r%   r   r?   rG   r'   r&   r(   r)   r*   r+   r,   Ú__classcell__r   r   r   r   r      s,    
	r   N)Útypingr   r   r   rJ   r   Ú	XMLwriterr   r   r   r   r   Ú<module>   s   	