U
    ª…7h   ã                   @   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edœdd„Zeeef dœdd	„Z	e
eef d
œdd„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zeeeeef  dœdd„Zeeef dœ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 )/Ú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__© úH/var/www/formularioweb/env/lib/python3.8/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)   s    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_pair©r   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)Z_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_tagZ
_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-propertiesZdocPropsVTypesÚxmlnszxmlns:vtr   )Ú_xml_start_tag)r   Zschemar.   Zxmlns_vtÚ
attributesr   r   r   r   a   s    þzApp._write_propertiesc                 C   s   |   dd¡ d S )NÚApplicationzMicrosoft Excel©Ú_xml_data_elementr   r   r   r   r    n   s    zApp._write_applicationc                 C   s   |   d| j¡ d S )NZDocSecurity)r3   r   r   r   r   r   r!   r   s    zApp._write_doc_securityc                 C   s   |   dd¡ d S )NZ	ScaleCropÚfalser2   r   r   r   r   r"   v   s    zApp._write_scale_cropc                 C   s&   |   d¡ |  d| j¡ |  d¡ d S )NZHeadingPairsÚvariant)r/   Ú_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 )NZTitlesOfPartsr   )r/   r
   r   r6   r,   )r   Z
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 ]2}|dkr:|  d¡ |  |¡ |dkr$|  d¡ q$|  d¡ d S )NÚsizeZbaseTypez	vt:vectorr5   z
vt:variant)Úlenr/   Ú_write_vt_datar,   )r   r7   r8   r0   Úvt_datar   r   r   r6      s    
þ

zApp._write_vt_vector)r<   c                 C   s   |   d|d › |d ¡ d S )Nzvt:r   r   r2   )r   r<   r   r   r   r;   ¡   s    zApp._write_vt_datac                 C   s   | j  dd¡}|  d|¡ d S )NÚcompanyÚ ZCompany©r   Úgetr3   )r   r=   r   r   r   r&   ¥   s    zApp._write_companyc                 C   s$   d| j krd S |  d| j d ¡ d S )NÚmanagerÚManager)r   r3   r   r   r   r   r%   ª   s    
zApp._write_managerc                 C   s   |   dd¡ d S )NZLinksUpToDater4   r2   r   r   r   r   r'   ±   s    zApp._write_links_up_to_datec                 C   s   |   dd¡ d S )NZ	SharedDocr4   r2   r   r   r   r   r(   µ   s    zApp._write_shared_docc                 C   s(   | j  d¡}|d krd S |  d|¡ d S )NÚhyperlink_baseZHyperlinkBaser?   )r   rC   r   r   r   r)   ¹   s    zApp._write_hyperlink_basec                 C   s   |   dd¡ d S )NZHyperlinksChangedr4   r2   r   r   r   r   r*   Â   s    zApp._write_hyperlinks_changedc                 C   s   |   dd¡ d S )NZ
AppVersionz12.0000r2   r   r   r   r   r+   Æ   s    zApp._write_app_version)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Ústrr   r   Úintr   r   r   r-   r   r    r!   r"   r#   r$   r   r6   r;   r&   r%   r'   r(   r)   r*   r+   Ú__classcell__r   r   r   r   r      s*   
	r   N)Útypingr   r   r   r>   r   Z	XMLwriterr   r   r   r   r   Ú<module>
   s   