
    fp                     `    d dl mZ d dlmZ  G d dej                  Z G d de          ZdS )   )	xmlwriter)preserve_whitespacec                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )SharedStringszA
    A class for writing the Excel XLSX sharedStrings file.

    c                 d    t          t          |                                            d| _        dS )z
        Constructor.

        N)superr   __init__string_table)self	__class__s    Z/var/www/ffwdstore.be/apps/py-env/lib/python3.11/site-packages/xlsxwriter/sharedstrings.pyr	   zSharedStrings.__init__   s/     	mT""++---     c                     |                                   |                                  |                                  |                     d           |                                  d S )Nsst)_xml_declaration
_write_sst_write_sst_strings_xml_end_tag
_xml_closer   s    r   _assemble_xml_filez SharedStrings._assemble_xml_file*   sj     	 	 	!!! 	%    	r   c                 t    d}d|fd| j         j        fd| j         j        fg}|                     d|           d S )Nz9http://schemas.openxmlformats.org/spreadsheetml/2006/mainxmlnscountuniqueCountr   )r
   r   unique_count_xml_start_tag)r   r   
attributess      r   r   zSharedStrings._write_sstB   sR    K ed'-.D-:;

 	E:.....r   c                 N    | j         j        D ]}|                     |           d S )N)r
   string_array	_write_si)r   strings     r   r   z SharedStrings._write_sst_stringsN   s8     '4 	# 	#FNN6""""	# 	#r   c                 *   g }|                      |          }t          |          r|                    d           |                    d          r,|                    d          r|                     |           d S |                     ||           d S )N)z	xml:spacepreservez<r>z</r>)_escape_control_charactersr   append
startswithendswith_xml_rich_si_element_xml_si_element)r   r"   r   s      r   r!   zSharedStrings._write_siT   s    
 0088 v&& 	97888 U## 	5(?(? 	5%%f-----  44444r   )
__name__
__module____qualname____doc__r	   r   r   r   r!   __classcell__)r   s   @r   r   r      s~         ! ! ! ! !   0
/ 
/ 
/# # #5 5 5 5 5 5 5r   r   c                   *    e Zd ZdZd Zd Zd Zd ZdS )SharedStringTablezD
    A class to track Excel shared strings between worksheets.

    c                 >    d| _         d| _        i | _        g | _        d S )N    )r   r   r
   r    r   s    r   r	   zSharedStringTable.__init__m   s'    
r   c                     || j         vr3| j        }|| j         |<   | xj        dz  c_        | xj        dz  c_        |S | j         |         }| xj        dz  c_        |S )z: " Get the index of the string in the Shared String table.r   )r
   r   r   )r   r"   indexs      r   _get_shared_string_indexz*SharedStringTable._get_shared_string_indexs   sp    ***%E(-Df%JJ!OJJ"L %f-EJJ!OJJLr   c                     | j         |         S )z& " Get a shared string from the index.)r    )r   r5   s     r   _get_shared_stringz$SharedStringTable._get_shared_string   s     ''r   c                 ^    t          | j        | j        j                  | _        i | _        dS )z= " Sort the shared string data and convert from dict to list.)keyN)sortedr
   __getitem__r    r   s    r   _sort_string_dataz#SharedStringTable._sort_string_data   s.    "4#4$:K:WXXXr   N)r+   r,   r-   r.   r	   r6   r8   r=    r   r   r1   r1   g   sZ         
    ( ( (    r   r1   N) r   utilityr   	XMLwriterr   objectr1   r>   r   r   <module>rC      s          ( ( ( ( ( (U5 U5 U5 U5 U5I' U5 U5 U5r" " " " " " " " " "r   