
    Xi                     &   d Z ddlmZ ddlZddlmZ ddlmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZ ddlT dZe	eeeeeeee
eiZdZedd	         Zd
ZeeeeeeeedZg dZd Z ddZ! G d de"          Z# G d dee#          Z$d Z%d Z& G d dee#          Z'i dddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d	d5i d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZZ(ddefdd/e	fd1d@efd[d\efdBdPe	fdRdVefd]d]e	fd^d^e
fd_d`efdadbe	fdcdde	fdedfefgZ)i Z*e)D ]\  Z+Z,Z- e.e+e,dz             D ]Z/e-e*e/<   [+[,[-[/ e0dg          Z1i Z2e1e13                                z   D ]Z4de2e4<   [4[1i Z5 e0dh          D ]Z4de5e4<    e0d          d e0di          d e0dj          diZ6 e0d,          d e0dX          d e0d          d e0dk          d e0dl          d e0dY          diZ7 ej8        dm          j9        Z:dn Z;efdoZ<dp Z=dq Z>dr Z?ds Z@dt ZAdu ZBdv ZCdw ZD G dx dyee#          ZE G dz d{ee#          ZF G d| d}ee#          ZG G d~ dee#          ZH G d de          ZIdS )z$
Module for formatting information.
    )print_functionN)unpack   )FDTFGEFNUFTXFUNXL_CELL_DATEXL_CELL_NUMBERXL_CELL_TEXT	XL_FORMAT
XL_FORMAT2
BaseObject	XLRDErrorfprintfunpack_stringunpack_unicodeupkbitsupkbitsL)*)8r   r   r      r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      r   r   r   r"   r   r   r   r"   r"   r"   r   r"   r   r"   r   r"   r"      r)   r)   r"   r"   r"      r,   r   r,   3   f   r   r      r1   r   r   r/   r   r/   r   r"   r"   r   r/   r1   r1   r1   r   r$   r   r   r    r&   r!   r'   r   r   r1   r   r2   r1   r   r1   r   r   r,   r,   r1   r   r   r,   r1   r1   r,   r   )   r=   r=   r.   r/   r   r.   r1   r1   r,   r1   r   r   r1   r   r   r,   r   r   r/   r   r/   r/   r,      rF   rF   r   r.   r/   r.   r,   r/   r   r.   r   r.   r.   r   r,   r.   r   r-   r.   r.   r,   r.   r.   r.      )8r   r   r   r   r   r   r   r    r!   r#   r$   r%   r&   r'   r(   r*   r+   r-   r0   r2   r3   r4   r5   r6   r$   r   r   r    r&   r!   r'   r   r7   r2   r8   r9   r:   r;   r<   )r   r1   r,   r>   r?   r@   rA   rB   rC   rD   rE   rG   rH   rI   rJ   rK   r-   rL   rM   )P   F   2   -   (            )
Normal	RowLevel_	ColLevel_CommaCurrencyPercentz	Comma [0]zCurrency [0]	HyperlinkzFollowed Hyperlinkc                 p   i | _         i | _        | j        sd S t          d          D ]}t          |         | j         |<   t
          | j                 }t          |          }t          |          D ]}||         | j         |dz   <   d | j         |dz   <   d | j         |dz   dz   <   d | j         d<   d | j         d<   d S )N   r   Q     )
colour_mapcolour_indexes_usedformatting_infoxrangeexcel_default_palette_b8default_palettebiff_versionlen)bookidpalndpals       :/usr/local/lib/python3.11/dist-packages/xlrd/formatting.pyinitialise_colour_mapro   i   s    DO!D AYY 9 95a84,-DIIEE]] ' '#Aw!  $DOE!G!%DOE!GAI DOD"DOF    c                     d}d}|                                  D ]@\  }}|d}t          ||          D ]\  }}	|||	z
  ||	z
  z  z  }||k     r|}|}|dk    r nA	 |S )z
    General purpose function. Uses Euclidean distance.
    So far used only for pre-BIFF8 ``WINDOW2`` record.
    Doesn't have to be fast.
    Doesn't have to be fancy.
    i   r   )itemszipprint)
rb   rgbdebugbest_metricbest_colourxcolourxcand_rgbmetricv1v2s
             rn   nearest_colour_indexr~      s      KL'--// 
 
#x(( 	, 	,FBrBw27++FFK K"L{{J rp   c                       e Zd ZdZd Zd ZdS )	EqNeAttrsz
    This mixin class exists solely so that :class:`Format`, :class:`Font`, and
    :class:`XF` objects can be compared by value of their attributes.
    c                 "    | j         |j         k    S N__dict__selfothers     rn   __eq__zEqNeAttrs.__eq__       }..rp   c                 "    | j         |j         k    S r   r   r   s     rn   __ne__zEqNeAttrs.__ne__   r   rp   N)__name__
__module____qualname____doc__r   r    rp   rn   r   r      s<         
/ / // / / / /rp   r   c                   `    e Zd ZdZdZdZdZdZdZdZ	dZ
dZ ed          ZdZdZdZdZdZdZdS )Fontz
    An Excel "font" contains the details of not only what is normally
    considered a font, but also several other display attributes.
    Items correspond to those in the Excel UI's Format -> Cells -> Font tab.

    .. versionadded:: 0.6.1
    r      N)r   r   r   r   boldcharacter_setcolour_index
escapementfamily
font_indexheightitalicUNICODE_LITERALname
struck_outunderline_type
underlinedweightoutlineshadowr   rp   rn   r   r      s          D0 M L J F J F F ?2D J N J F G FFFrp   r   c                 d    | j         sd S t          d|          d         | j        d         _        d S )N<Hr   )rd   r   	font_listr   )rj   datas     rn   handle_efontr     s6     &,T4&8&8&;DN2###rp   c           	         | j         sd S | j        s|                                  t          p
| j        dk    }| j        }t          | j                  }|dk    rHt                      }t          d          |_
        ||_        | j                            |           |dz  }t                      }||_        | j                            |           |dk    rt          d|dd                   \  |_        }|_        |_        |_        |_        |_        |_        |dz  |_        |dz  dz	  |_        |dz  dz	  |_        |d	z  d
z	  |_        |dz  dz	  |_        |dz  dz	  |_        |dk    rt7          |dd          |_
        nt9          |d| j        d          |_
        n|dk    rt          d|dd                   \  |_        }|_        |dz  |_        |dz  dz	  |_        |dz  dz	  |_        |d	z  d
z	  |_        |dz  dz	  |_        |dz  dz	  |_        t9          |d| j        d          |_
        ddg|j                 |_        d|_        |j        |_        d|_        d|_        nt          d|dd                   \  |_        }d|_        |dz  |_        |dz  dz	  |_        |dz  dz	  |_        |d	z  d
z	  |_        d|_        d|_        t9          |d| j        d          |_
        ddg|j                 |_        d|_        |j        |_        d|_        d|_        |r'|                    | j        d|j        z  d           d S d S )N      z
Dummy Fontr   rQ   z	<HHHHHBBBr      r_      rN          rO      lenlenrT   z<HHH   r   i  z<HHra   z--- handle_font: font[%d] ---z-------------------headerfooter)rd   encodingderive_encodingDEBUG	verbosityrh   ri   r   r   r   r   r   appendr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   dumplogfile)rj   r   blahbvkfoption_flagss          rn   handle_fontr     s    = 'DNa'D		BDNAAvvFF ..a   	QAALN!	Rxx
 ;QrT
++		
HlANAHL!*AHO! 1$*$q(Q.$q(Q.!B&1,	 2%!+88#D"Q777AFF"4T]1EEEAFF	r17QqS	1J1J.,! 1$*$q(Q.$q(Q.!B&1,	 2%!+tQa@@@:af%<!'tAaCy!9!9,! 1$*$q(Q.$q(Q.	tQa@@@:af%< 
	L2Q\A( 	 	
 	
 	
 	
 	

 
rp   c                   6    e Zd ZdZdZeZ ed          Zd Z	dS )Formatz\
    "Number format" information from a ``FORMAT`` record.

    .. versionadded:: 0.6.1
    r   r   c                 0    || _         || _        || _        d S r   )
format_keytype
format_str)r   r   tyr   s       rn   __init__zFormat.__init__g  s    $	$rp   N)
r   r   r   r   r   r
   r   r   r   r   r   rp   rn   r   r   O  sL          J D !$$J% % % % %rp   r   General0r   z0.00r   z#,##0r   z#,##0.00r   z$#,##0_);($#,##0)r   z$#,##0_);[Red]($#,##0)   z$#,##0.00_);($#,##0.00)r_   z$#,##0.00_);[Red]($#,##0.00)	   z0%
   z0.00%   z0.00E+00   z# ?/?r   z# ??/??r   zm/d/yy   zd-mmm-yyzd-mmm   zmmm-yy   z
h:mm AM/PM   zh:mm:ss AM/PMrV   zh:mmrU   zh:mm:ss   zm/d/yy h:mm%   z#,##0_);(#,##0)&   z#,##0_);[Red](#,##0)'   z#,##0.00_);(#,##0.00)rS   z#,##0.00_);[Red](#,##0.00))   z'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)*   z*_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)+   z/_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_),   z2_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)rR   zmm:ss.   z	[h]:mm:ss/   zmm:ss.0z##0.0E+0@)0   1      $   r   r   rQ   :   ;   >   C   rP   G   r`   ymdhsz$-+/(): #?GENERALgeneralz	\[[^]]*\]c                    d}d}|D ]w}|dk    r:|t          d          k    rd}nH|t          d          v rd}n4|t          v rn*||z  }n$|dk    r|t          d          k    rd}n|dk    rd}d|cxk    rdk    sn J x| j        dk    r&t          dt	          |          z  | j        	           t          d|          }|t          v rd
S d}d}d}dx}}|D ]>}|t          v r|t          |         z  }|t          v r|t          |         z  }6||k    rd}?|r|sdS |r|sd
S |r | j        rt          | j        d|||           n|s| j        rt          | j        d|           ||k    S )Nr   r   "r   z\_*r   r   z+is_date_format_string: reduced format is %sfileF;Tz7WARNING *** is_date_format: ambiguous d=%d n=%d fmt=%r
z/WARNING *** format %r produces constant result
)r   skip_char_dictr   rt   REPRr   fmt_bracketed_subnon_date_formatsdate_char_dictnum_char_dictr   )	rj   fmtstatesc	separatorgot_sep
date_count	num_counts	            rn   is_date_format_stringr    s    E
A  A::OC((((of----n$$QaZZOC((((aZZEEQ~;d1ggEDLYYYY"a  AuEIGJ  .++JJ-q))II)^^G ) t  u 	> 	,DLJIs, , ,  > 	DLB   	!!rp   c                    d}| j         }|t          k    rt          |d          }| j        s|                                  d}|dk    rt          d|dd                   d         }n| j        }|dk    rd}| xj        dz  c_        |dk    rt          |d          }nt          ||| j        d          }|p
| j	        d	k    }|rt          | j        d
| j        |||           |                     |          }	t          t          g|	         }
|dk    sf|dk     s`t                              |t"                    }|t          k    }| j	        r.d|cxk     rdk     r!n n||	z  rd}t          | j        d||           |dk    rt          | j        d|
||	|           t%          ||
|          }|r(|                    | j        d| j        dz
  fz             || j        |<   | j                            |           d S )Nr   rT   r   rQ   r   r   rO   r   r   z)FORMAT: count=%d fmtkey=0x%04x (%d) s=%r
   zHWARNING *** Conflict between std format key %d and its format string %r
z2ty: %d; is_date_c: %r; is_date_s: %r; fmt_strg: %rz--- handle_format [%d] ---)r   )rh   r   minr   r   r   actualfmtcountr   r   r   r   r   r  r   r   std_format_code_typesgetr
   r   r   
format_mapformat_listr   )r   r   rectyper   r   strposfmtkeyunistrgr   	is_date_sr   std_ty	is_date_cfmtobjs                 rn   handle_formatr    sT   E		B*R[[= F	Rxxd1Q3i((+$88F1	Rxx q))fdmAFFF'DNa'D :8	: 	: 	: **733I
sI	BC<<277 '**6377cM	> 	!a&oooo2ooooo9y3HoEDL?! ! ! zz@	9g	/ 	/ 	/ FB((F MDL/43Fq3H2KK 	 	M 	M 	M$DOFF#####rp   c                    | j         sd S t          p
| j        dk    }t          d|d d                   \  }d| j        dk             }t          s| j        dk    r||k    rt          | j        d||           n|rt          | j        d|           d|z  }d	|z  dz   }t          |          }d	}||cxk    r	||z   k    sn t          d
||fz            t          ||d |                   }	| j	        g k    sJ t          |          D ]}
|	|
         }|dz  }|dz	  dz  }|dz	  dz  }| j        d|
z            }|||f}| j	                            |           || j        d|
z   <   |r"||k    rt          d|
||fz  | j                   d S )Nr   r   )rN   8   rQ   r   z9NOTE *** Expected %d colours in PALETTE record, found %d
zPALETTE record with %d colours
z<xx%dir   z0PALETTE record: expected size %d, actual size %dr   r_   rN   z%2d: %r -> %rr   )rd   r   r   r   rh   r   r   ri   r   palette_recordre   rb   r   rt   )rj   r   r   	n_coloursexpected_n_coloursr   expected_sizeactual_size	tolerancecoloursrk   r   redgreenblueold_rgbnew_rgbs                    rn   handle_paletter%  A  s    'DNa'Dd2A2h''JI!$"3r"9: ;1$$)7I*I*IH		+ 	+ 	+ 	+ 
 ;.		; 	; 	;
Y
C	MA%Md))KIKDDDD=9+DDDDDJm]hMiijjjS$~~.//G"$$$$ I R RAJDqD bD /!A#&t$""7+++&! 	R'!!oGW(==DLQQQQR Rrp   c                    | j         D ]}|j        dk    r|j        }|dk    r|| j        v rd| j        |<   0| j        rKt          dt          | j                  | j                   t          | j        d|j        |j
        |           | j        dk    rAt          | j                                                  }t          d|z  | j                   d S d S )Nr   ra   r   zSize of colour table:r   z2*** Font #%d (%r): colour index 0x%04x is unknown
z
Colour indexes used:
%r
)r   r   r   rb   rc   r   rt   ri   r   r   r   sortedkeys)rj   fontcxuseds       rn   palette_epiloguer,  e  s      0 0?a<<  +,D$R((^ 	0)3t+?+?dlSSSSDL"WB0 0 0~d.335566,t3$,GGGGGG rp   c           	         | j         sd S t          p
| j        dk    }| j        }t	          d|d d                   \  }}}|dz  }|dk    rd| j        vrd}d}d}d}	d	}n|d
z  r5d}t          |         }	d|cxk    rdk    rn n|	t          |dz             z  }	nd}d}d}|dk    rl	 t          |dd          }	np# t          $ rK t          d||||fz  | j                   t          dt          |dd                    | j                    w xY wt          |d| j        d          }	|r|	st          d| j                   ||f| j        |	<   |rt          | j        d|||||	           d S d S )Nr   z<HBBr     s       rW   r   r   r   i   rO   r   z6STYLE: built_in=%d xf_index=%d built_in_id=%d level=%dr   z
raw bytes:z7WARNING *** A user-defined style has a zero-length namez?STYLE: built_in=%d xf_index=%d built_in_id=%d level=%d name=%r
)rd   r   r   rh   r   style_name_mapbuilt_in_style_namesstrr   UnicodeDecodeErrorrt   r   reprr   r   r   )
rj   r   r   r   flag_and_xfxbuilt_in_idlevelxf_indexbuilt_inr   s
             rn   handle_styler9  y  s    'DNa'D		B'-fd2A2h'?'?$L+uf$H{xt/BBB 		 `#K0    q     C	NN"D 88%dAa888%   N;>?EI\S S S SlDabbNNFFFF	 !q$-BBBD 	` 	`KRVR^____!)8 4D :`hUD	: 	: 	: 	: 	:: :s   %B8 8ADc                 R   t          |j                                                  }|D ]}\  }}t          |d          rt	          | ||           '|                    d          dk    r=|| j        v rd| j        |<   T|j        j	        }t          d||||fz  | j                   ~d S )Nr   r   r   r   z&*** xf #%d : %s.%s =  0x%04x (unknown)r   )r'  r   rr   hasattrcheck_colour_indexes_in_objfindrb   rc   	__class__r   rt   r   )rj   obj
orig_indexalistattrnobjonames          rn   r<  r<    s    3<%%''((E 	F 	F
d4   	F'dJ????YY~&&!++t&&12(.M*E:udD128<F F F F	F 	Frp   c                     t                                           D ]M}|| j        vrBt           |         }t                              |          }t          |||          }|| j        |<   Nd S r   )r
  r(  r  std_format_stringsr  r   )rj   xr   fmt_strr  s        rn   fill_in_standard_formatsrI    sq    "'')) ( (DO##&q)B ),,Q//GAr7++F!'DOA( (rp   c                    t           p
| j        dk    }| j        }t                      }t	                      |_        d|j        _        d|j        _        d|j        _        t                      |_
        d|j
        _        d|j
        _        d|j
        _        d|j
        _        t                      |_        t#                      |_        |dk    r| j        st)          |            |dk    rd}t+          ||dd                   \
  |_        |_        }}|j        _        }}	}
}}t3          |j        |d           t3          ||d           t3          |j        |d	           t3          |j        |d
           |	dz	  }g d}|D ]#}d|z   dz   }t5          |||dz             |dz  }$t7          |j
        |
d           t3          |j
        |d           t7          |j        |d           t3          |j        |d           n|dk    rd}t+          ||dd                   \  |_        |_        }}}}
}t3          |j        |d           t3          ||d           t3          |j        |d	           |dz  }g d|         |j        _        |dz	  }g d}|D ]#}d|z   dz   }t5          |||dz             |dz  }$t7          |j        |
d           t7          |j
        |
d           t3          |j
        |d           n|dk    rd}t+          ||dd                   \  |_        |_        }}}	}}t3          |j        |d           t3          ||d           t3          |j        |d           |dz  dz	  }g d|         |j        _        |	dz	  }g d}|D ]#}d|z   dz   }t5          |||dz             |dz  }$t3          |j        |d            t7          |j
        |d!           n|d"k    rd#}t+          ||dd                   \  |_        |_        }}	}}}t3          |j        |d           t3          ||d$           t3          |j        |d%           t3          ||d&           |	dz	  }g d}|D ]#}d|z   dz   }t5          |||dz             |dz  }$t3          |j        |d            t7          |j
        |d!           d|j        _        d|j        _        n|d'k    rt+          d(|          \  |_        }}|d)z  |_        t3          |j        |d*           t3          |j        |d+           d,D ]G\  }}||z  rd-\  }}nd.\  }}t5          |j
        |d/z   |           t5          |j
        |d0z   |           H|j        }|d1z  rd2|_        nd|_        d3|_        d4|_        d|_         d|j        _        d|j        _        g d}|D ]}d|z   dz   }t5          ||d           ntC          d5|z            tE          | j#                  |_$        | j#        %                    |           | xj        dz  c_        |r%|&                    | j'        d6|j$        z  d78           	 | j(        |j                 }tR          |j*                 } n# tV          $ r
 tX          } Y nw xY w| | j-        |j$        <   | j.        rR| j        r5|j/        r.|j         d9k    r#d:}!ta          | j'        |!|j$        |j                    tc          | ||j$                   |j        | j(        vr9d;}!| j        r'ta          | j'        |!|j$        |j        |j                   d|_        d S d S )<Nr   r   rQ   rO   z<HHHBBBBIiHrV   ))r   r   cell_locked)r   r   formula_hidden)r   r   is_styler   r_   lotus_123_prefixr   i  parent_style_index)r   r   	hor_alignr   r_   text_wrapped)r   p   
vert_align))r   r   indent_level)r   rN   shrink_to_fit)r   r)   text_directionr   )formatr)  	alignmentborder
background
protection__flagr   ))r   r   left_line_style)r      right_line_style)r_   i   top_line_style)r   i   bottom_line_stylerN   i   left_colour_index   i  ?right_colour_index)rT   i   @	diag_down)   l        diag_up))r      top_colour_index)r   ?  bottom_colour_index)r   i  diag_colour_index)rU   i  diag_line_style))   l      x fill_pattern)r   rp  pattern_colour_indexr   rr  background_colour_indexz<HHHBBIirN   )r   r   Z      )rx  rz  )rN   i  ? rw  ))r   i  rg  )   l      | rs  )r   r   rf  )r   r  rc  )r   i  re  )r   i   rq  rh  rj  rS   z<BBHBBHIr   )rS  rU  )r   r   rX  r)   r   ))r   ?   rw  )r   i  ry  )r      r{  )r  )r      rq  )r_   i   rc  )r   r  ri  )rN   i   rg  )r   i   rs  )   i   re  )r   l      p rl  rT   z<BBBBHHI)rM  rO  )rS  rU  )rQ  rU   z<BxBBr  ))r   @   rK  )r   r"   rL  )rS  ))r_   left)rN   right)r   top)r  bottom)r_   r   )r   r   _colour_index_line_styler"   r   r   r_   zprogrammer stuff-up: bv=%dz--- handle_xf: xf[%d] --- r   r.  zNWARNING *** XF[%d] is a style XF but parent_style_index is 0x%04x, not 0x0fff
z9WARNING *** XF[%d] unknown (raw) format key (%d, 0x%04x)
)2r   r   rh   XFXFAlignmentr]  rY  rZ  r[  XFBorderr^  ro  rm  rt  ru  XFBackgroundr_  XFProtectionr`  xfcountrI  r   r   r   rotationr   setattrr   rX  rw  r{  ry  rR  r   ri   xf_listr7  r   r   r   r  _cellty_from_fmttyr   KeyErrorr   _xf_index_to_xl_type_maprd   rN  r   r<  )"r   r   r   r   xf
unpack_fmtpkd_type_par
pkd_align1
pkd_align2pkd_usedpkd_brdbkg1pkd_brdbkg2pkd_brdbkg3reg
attr_stems	attr_stemrB  pkd_orient_usedorientationpkd_align_orient
pkd_bkg_34
pkd_brd_34pkd_type_protpkd_align_par
format_etc
halign_etcmasksider   
line_stylebgr   celltymsgs"                                     rn   	handle_xfr    s	    'DNa'D		B	B==BL !BL!"BL"#BL

BIBIBI"#BI !BI NNBM NNBM	Rxxx &&&	Rxx"

 :tAbDz**		
M2=,-zk;| .
 	 	 	 	L #
 	 	 	 	j +
 	 	 	
 	j +
 	 	 	
 !m
 
 

 $ 	 	I?W,DBcAg&&&AICCK 	*
 		 		 		 		; )
 	 	 	 	 .
 	 	 	 	{ -
 	 	 	 	 
r

 :tAbDz**		
M2=,| .
 	 	 	 	L #
 	 	 	
 	j +
 	 	 	
 &, 1 1 1+ >"
 
 

 $ 	 	I?W,DBcAg&&&AICC .
 	 	 	
 	K *
 	 	 	 		; )
 	 	 	 	 
r

 :tAbDz**		
M2=,h
| .
 	 	 	 	L #
 	 	 	
 	. 1
 	 	 	
 ($.14 1 1 1+ >!m
 
 

 $ 	 	I?W,DBcAg&&&AICCz ,
 	 	 	
 	J 	)
 		 		 		 		 
r

 :tAbDz**		
M2=-m
} /
 	 	 	 	M $
 	 	 	 	m .
 	 	 	 	M $
 	 	 	 !m
 
 

 $ 	 	I?W,DBcAg&&&AICCz ,
 	 	 	
 	J 	)
 		 		 		 #$ !	r
 39$2G2G/
J"T)z ,
 	 	 	 	j +
 	 	 	 ] 	A 	AJD$D  0+/(jj+/(jBIto5|DDDBItm3Z@@@@] 	  BOOBO%&""# !"# !
 
 

 $ 	! 	!I?W,DBa    	! 4r9:::dl##BKLLLALL 

L.< 	 	
 	
 	

 obm,#CH-       17D!"+.  ;> 	Kbk 	Kb.Cv.M.McCDL#r{B4IJJJ#D"bk:::	}DO++J> 	;DL#R]BM; ; ; ,+s    $Z ZZc                 0   d| _         t          | j                  }t          p
| j        dk    }t          p
| j        dk    }|rt          | j        d           d }t          |          D ]}| j        |         }	 | j        |j	                 }t          |j                 }n# t          $ r
 t          }Y nw xY w|| j        |j        <   | j        sd|j        rld|j        cxk    r|k     s2n |r't          | j        d|j        |j        |j                   d|_        | j        dk    r|rj|j        |j        k    r"t          | j        d|j        |j                   n8| j        |j                 j        s!t          | j        d	|j        |j                   |r1|j        |j        k    r!t          | j        d
|j        |j                   | j        |j                 }	|j        s|	j        s|r || ||	d           |j        s|	j        s|r || ||	d           |j        s|	j        s|r || ||	d           |j        s|	j        s|r || ||	d           |j        sr|	j        sk|ri|j	        |	j	        k    rYt          | j        d|j        |j	        |	j        |	j	        | j        |j	                 j        | j        |	j	                 j                   |j        sF|	j        s?|r=|j        |	j        k    r-t          | j        d|j        |j        |	j        |	j                   d S )Nr   r   zxf_epilogue called ...
c                     t          ||          t          ||          k    r$t          | j        d|j        |j        |           d S d S )Nz(NOTE !!! XF[%d] parent[%d] %s different
)getattrr   r   r7  )book_argxf_arg
parent_argrB  s       rn   
check_samezxf_epilogue.<locals>.check_same  sY    64  GJ$=$===H$;!4d< < < < < >=rp   r   z:WARNING *** XF[%d]: is_style=%d but parent_style_index=%d
rT   z/NOTE !!! XF[%d]: parent_style_index is also %d
z>NOTE !!! XF[%d]: parent_style_index is %d; style flag not set
z9NOTE !!! XF[%d]: parent_style_index is %d; out of order?
r]  r_  r^  r`  z4NOTE !!! XF[%d] fmtk=%d, parent[%d] fmtk=%r
%r / %r
z.NOTE !!! XF[%d] fontx=%d, parent[%d] fontx=%r
)_xf_epilogue_doneri   r  r   r   r   r   re   r  r   r  r   r  r   r  r7  rd   rN  rR  rh   _alignment_flag_background_flag_border_flag_protection_flag_format_flagr   
_font_flagr   )
r   num_xfsr   blah1r  xfxr  r   r  parents
             rn   xf_epiloguer    s   D$,G'DNa'D(T^q(E :8999< < < g 7X 7X\#	"/"-0C'1FF 	" 	" 	"!FFF	"5;%bk2# 	; 	B)3333G3333 EQKb.CE E E %&B!"" <(BK77DLJR%:< < < < b&;<E <DLYR%:< < <  8.<<PK!68 8 8 \""78F% Df.D DC**T2v{CCC& Ev/F ED**T2v|DDD? A6+> A@**T2vx@@@& Ev/F ED**T2v|DDD? G6+> G GR]f.???DLPR]FOVEV6A(9:E	G G G
 = X): X XR]f.???DLIR]FOVEVX X Xk7X 7Xs   :$BB32B3c           	          t          |            d| _        t          t          t          t
          t          t          t          t          t          f	}|D ]}t          | j        |j        |           d S )Nr   )ro   r  r   r   r  r  r%  r,  r9  r  r  r  r>  r   )rj   methodsmethods      rn   initialise_bookr  A  sn    $D
G  9 988889 9rp   c                   B    e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZdS )r  ao  
    A collection of the border-related attributes of an ``XF`` record.
    Items correspond to those in the Excel UI's Format -> Cells -> Border tab.

    An explanations of "colour index" is given in :ref:`palette`.

    There are five line style attributes; possible values and the
    associated meanings are::

      0 = No line,
      1 = Thin,
      2 = Medium,
      3 = Dashed,
      4 = Dotted,
      5 = Thick,
      6 = Double,
      7 = Hair,
      8 = Medium dashed,
      9 = Thin dash-dotted,
      10 = Medium dash-dotted,
      11 = Thin dash-dot-dotted,
      12 = Medium dash-dot-dotted,
      13 = Slanted medium dash-dotted.

    The line styles 8 to 13 appear in BIFF8 files (Excel 97 and later) only.
    For pictures of the line styles, refer to OOo docs s3.10 (p22)
    "Line Styles for Cell Borders (BIFF3-BIFF8)".</p>

    .. versionadded:: 0.6.1
    r   N)r   r   r   r   rq  rs  ri  rl  rt  rf  rg  rc  re  ru  rm  ro  r   rp   rn   r  r  R  sr         @     N  O  O I GGGrp   r  c                       e Zd ZdZdZdZdZdS )r  a  
    A collection of the background-related attributes of an ``XF`` record.
    Items correspond to those in the Excel UI's Format -> Cells -> Patterns tab.

    An explanations of "colour index" is given in :ref:`palette`.

    .. versionadded:: 0.6.1
    r   N)r   r   r   r   rw  r{  ry  r   rp   rn   r  r    s1          L   rp   r  c                   .    e Zd ZdZdZdZdZdZdZdZ	dZ
dS )r  z
    A collection of the alignment and similar attributes of an ``XF`` record.
    Items correspond to those in the Excel UI's Format -> Cells -> Alignment tab.

    .. versionadded:: 0.6.1
    r   N)r   r   r   r   rT  rX  r  rV  rY  rZ  r[  r   rp   rn   r  r    sI          I J H L L M NNNrp   r  c                       e Zd ZdZdZdZdS )r  ad  
    A collection of the protection-related attributes of an ``XF`` record.
    Items correspond to those in the Excel UI's Format -> Cells -> Protection tab.
    Note the OOo docs include the "cell or style" bit in this bundle of
    attributes. This is incorrect; the bit is used in determining which bundles
    to use.

    .. versionadded:: 0.6.1
    r   N)r   r   r   r   rK  rL  r   rp   rn   r  r    s&          K NNNrp   r  c                   N    e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZdZdZdZdS )r  a  
    eXtended Formatting information for cells, rows, columns and styles.

    Each of the 6 flags below describes the validity of
    a specific group of attributes.

    In cell XFs:

    - ``flag==0`` means the attributes of the parent style ``XF`` are
      used, (but only if the attributes are valid there);

    - ``flag==1`` means the attributes of this ``XF`` are used.

    In style XFs:

    - ``flag==0`` means the attribute setting is valid;
    - ``flag==1`` means the attribute should be ignored.

    .. note::
      the API provides both "raw" XFs and "computed" XFs. In the latter case,
      cell XFs have had the above inheritance mechanism applied.

    .. versionadded:: 0.6.1
    r   N)r   r   r   r   rN  rR  r  r  r  r  r  r  r7  r   r   r`  r_  r]  r^  r   rp   rn   r  r    s         4 H
  L J O L  H J J J J I FFFrp   r  )r   )Jr   
__future__r   restructr   biffhr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   timemachiner   r  excel_default_palette_b5excel_default_palette_b2rf   rg   r0  ro   r~   objectr   r   r   r   r   rF  fmt_code_rangesr
  lohir   re   rG  r   
date_charsr   upper_cr   r   r   compilesubr   r  r  r%  r,  r9  r<  rI  r  r  r  r  r  r  r  r  r   rp   rn   <module>r     s    & % % % % % 				                                           
    	   " 4CRC8  $ 	!       	 	*   # # #0   2
/ 
/ 
/ 
/ 
/ 
/ 
/ 
/Y Y Y Y Y:y Y Y Yv< < <
E
 E
 E
R% % % % %Z % % %:( 	)	(
 	#( 	&( 	'( 	*( 	
( 	
"( 	
#( 	
(( 	$( 	'( 	*(  	'!(" 	)#($ 	(%(& 	*'(( 	')( (* 	(+(, 	,-(. 	//(0 	&1(2 	)3(4 	-5(6 	
7(8 	
 9(: 	
!;(< 	
&=(> 	
5?(@ 	
8A(B 	
=C(D 	
@E(F 	'G(H 	+I(J 	)K( (L 
O( ( ( Z !SMSMSMSMSMSMSMSMSMSMSMSM$  ! & &JBBVB1 & &#%a  &B_W%%

z''))
)  BN2

/*
%
%  BN2 OC!OC!OC! OJOJOIOIOIOC  BJ|,,0 =" =" ="~ '0 0$ 0$ 0$ 0$h"R "R "RHH H H(): ): ):VF F F	( 	( 	(z z zx	GX GX GXR9 9 9"A A A A Az9 A A AF    :y   (         *i      D    :y   &N N N N N N N N N Nrp   