
    ,h                        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 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 Z2e1e1jg                         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jp                  dm      jr                  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      ZIy)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                    i | _         i | _        | j                  sy 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<   y )N   r   Q     )
colour_mapcolour_indexes_usedformatting_infoxrangeexcel_default_palette_b8default_palettebiff_versionlen)bookidpalndpals       Q/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/xlrd/formatting.pyinitialise_colour_mapro   i   s    DO!DAY 95a89 4,,-DIEE] '#Aw!'  $DOOE!G!%DOOE!GAI DOOD"DOOF    c                     d}d}| j                         D ]=  \  }}|	d}t        ||      D ]  \  }}	|||	z
  ||	z
  z  z  } ||k  s3|}|}|dk(  s= n 	 |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++F	,K K"L{
 	 rp   c                       e Zd ZdZd Zd Zy)	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                 4    | j                   |j                   k(  S N__dict__selfothers     rn   __eq__zEqNeAttrs.__eq__       }}..rp   c                 4    | j                   |j                   k7  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                   X    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y)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      su     D. M L J F J F F 2D J N J F G Frp   r   c                 `    | j                   sy t        d|      d   | j                  d   _        y )N<Hr   )rd   r   	font_listr   )rj   datas     rn   handle_efontr      s+    &,T4&8&;DNN2#rp   c           	         | j                   sy | j                  s| j                          t        xs | j                  dk\  }| j
                  }t        | j                        }|dk(  rAt               }t        d      |_
        ||_        | j                  j                  |       |dz  }t               }||_        | j                  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;                  | j<                  d|j                  z  d       y y )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.   =='DNNa'D			BDNNAAvF .a 	QAALNN!	Rx
 ;Qr
+		
HlANAHL!*AHO! 1$*$q(Q.$q(Q.!B&1,	 2%!+8#D"Q7AF"4T]]1EAF	r17Qq	1J.,! 1$*$q(Q.$q(Q.!B&1,	 2%!+tQa@:aff%<<!'tAay!9,! 1$*$q(Q.$q(Q.	tQa@:aff%<<	LL2Q\\A( 	 	
 rp   c                   .    e Zd ZdZdZeZ ed      Zd Z	y)Formatz\
    "Number format" information from a ``FORMAT`` record.

    .. versionadded:: 0.6.1
    r   r   c                 .    || _         || _        || _        y r   )
format_keytype
format_str)r   r   tyr   s       rn   __init__zFormat.__init__d  s    $	$rp   N)
r   r   r   r   r   r
   r   r   r   r   r   rp   rn   r   r   L  s&     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 ]d  }|dk(  r0|t        d      k(  rd}n<|t        d      v rd}n,|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  raJ  J  | j                  dk\  r#t        dt	        |      z  | j
                  	       t        d|      }|t        v ry
d}d}d}dx}}|D ]4  }|t        v r|t        |   z  }|t        v r|t        |   z  }-||k(  s3d}6 |r|sy|r|sy
|r*| j                  rt        | j
                  d|||       ||kD  S |s#| j                  rt        | j
                  d|       ||kD  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aZOC((aZEEQ!" ~~;d1gEDLLY"a AEIGJ .++J-q))I)^G )>>DLLJIs, 	!! >>DLLB 	!!rp   c                    d}| j                   }|t        k(  rt        |d      }| j                  s| j	                          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      }|xs | j                  d	k\  }|r$t        | j                  d
| j                  |||       | j                  |      }	t        t        g|	   }
|dkD  sa|dk  s\t        j!                  |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'                  | j                  d| j                  dz
  fz         || j(                  |<   | j*                  j-                  |       y )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  
  s   E			B*R[==F	Rxd1Qi(+$$8F1	Rx q)fdmmAF'DNNa'D8	: **73I
sI	BC<27 '**637cM	>>a&o2o9y3HEDLL?! z@	9g	/ FB(FDLL/43F3Fq3H2KK 	 	M$DOOFF#rp   c                    | j                   sy t        xs | j                  dk\  }t        d|d d       \  }d| j                  dk\     }t        s| j                  dk\  r||k7  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                  |       || j                  d|
z   <   |sd||k7  sjt        d|
||fz  | j                          y )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%  >  s   'DNNa'Dd2Ah'JI!$"3"3r"9:1$)7I*IH		+ 
.		;
Y
C	MA%Md)KIKD=9+DDJm]hMiijjS$~./G"$$ I RAJDqD bD //!A#&t$""7+&!'!oGW(==DLLQRrp   c                 
   | j                   D ]  }|j                  dk(  r|j                  }|dk(  r%|| j                  v rd| j                  |<   C| j
                  sPt        dt        | j                        | j                         t        | j                  d|j                  |j                  |        | j
                  dk\  r>t        | j                  j                               }t        d|z  | j                         y y )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,  b  s      0??a< +,D$$R(^^)3t+?dllSDLL"WB00 ~~d..3356,t3$,,G rp   c           	         | j                   sy t        xs | 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  r+d}t        |   }	d|cxk  rdk  rdn na|	t        |dz         z  }	nOd}d}d}|dk\  r	 t        |dd      }	nt        |d| j                  d      }	|r|	st        d| j                         ||f| j
                  |	<   |rt        | j                  d|||||	       y y # t        $ rD t        d||||fz  | j                         t        dt        |dd        | j                          w xY w)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  v  s   'DNNa'D			B'-fd2Ah'?$L+uf$H{xt/B/BB 		#K0 q C	N"D 8%dAa8 !q$--BDKRVR^R^_!)8 4D`hUD	:  & N;>?EI\\SlDabNF	s   #D AE#c                 `   t        |j                  j                               }|D ]  \  }}t        |d      rt	        | ||        |j                  d      dk\  s5|| j                  v rd| j                  |<   S|j                  j                  }t        d||||fz  | j                          y )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
d4 'dJ?YY~&!+t&12((.MM**E:udD128<F	Frp   c                     t         j                         D ]K  }|| j                  vst         |   }t        j	                  |      }t        |||      }|| j                  |<   M y r   )r
  r(  r  std_format_stringsr  r   )rj   xr   fmt_strr  s        rn   fill_in_standard_formatsrI    s^    "'') (DOO#&q)B ),,Q/GAr7+F!'DOOA(rp   c                 X   t         xs | 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 ]I  \  }}||z  rd-\  }}nd.\  }}t5        |j                  |d/z   |       t5        |j                  |d0z   |       K |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        | jF                        |_$        | jF                  jK                  |       | xj&                  dz  c_        |r+|jM                  | jN                  d6|jH                  z  d78       	 | jP                  |j.                     }tR        |jT                     } | | jZ                  |jH                  <   | j\                  rl| j                  rI|j^                  r=|j@                  d9k7  r.d:}!ta        | jN                  |!|jH                  |j@                         tc        | ||jH                         |j.                  | jP                  vrMd;}!| j                  r7ta        | jN                  |!|jH                  |j.                  |j.                         d|_        y y # tV        $ r
 tX        } Y 	w xY w)<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    'DNNa'D			B	B=BL !BLL!"BLL"#BLL
BIBIIBII"#BII !BII NBM NBM	Rx &	Rx"

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

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

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

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

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

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

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

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

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

 oobmm,#CHH- 28D!!"++. >>bkkb.C.Cv.McCDLL#r{{B4I4IJ#D"bkk:	}}DOO+J>>DLL#R]]BMM; ,    s   3,^ ^)(^)c                 L   d| _         t        | j                        }t        xs | j                  dk\  }t        xs | j                  dk\  }|rt        | j                  d       d }t        |      D ]  }| j                  |   }	 | j                  |j                     }t        |j                     }|| j                  |j                  <   | j                   sf|j"                  rsd|j$                  cxk  r|k  sBn |r7t        | j                  d|j                  |j"                  |j$                         d|_        | j&                  dk\  s|r|j$                  |j                  k(  r-t        | j                  d|j                  |j$                         nO| j                  |j$                     j"                  s,t        | j                  d	|j                  |j$                         |rE|j$                  |j                  kD  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       |j0                  s|	j0                  s|r|j                  |	j                  k7  rt        | j                  d|j                  |j                  |	j                  |	j                  | j                  |j                     j2                  | j                  |	j                     j2                         |j4                  r,|	j4                  r:|s>|j6                  |	j6                  k7  sYt        | j                  d|j                  |j6                  |	j                  |	j6                          y # t        $ r
 t        }Y qw xY w)Nr   r   zxf_epilogue called ...
c                     t        ||      t        ||      k7  r.t        | j                  d|j                  |j                  |       y y )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  sA    64 GJ$==H$$;!4!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    sD   D$,,G'DNNa'D(T^^q(E89< g 7X\\#	"//"--0C'1F 6<%%bkk2##;;B))3G3QKKb.C.CE %&B!"((BKK7DLLJR%:%:< b&;&;<EEDLLYR%:%:< ..<PKK!6!68 \\""7"78F%%f.D.D*T2v{C&&v/F/F*T2v|D??6+>+>*T2vx@&&v/F/F*T2v|D??6+>+>R]]f.?.??DLLPR]]FOOVEVEV6AA(9(9:EE	G
 ==):):R]]f.?.??DLLIR]]FOOVEVEVXk7X  	"!F	"s   ,PP#"P#c           	          t        |        d| _        t        t        t        t
        t        t        t        t        t        f	}|D ]#  }t        | j                  |j                  |       % y )Nr   )ro   r  r   r   r  r  r%  r,  r9  r  r  r  r>  r   )rj   methodsmethods      rn   initialise_bookr  >  sY    $D
G  989rp   c                   @    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y)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  O  sa    @     N  O  O I Grp   r  c                       e Zd ZdZdZdZdZy)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    s     L   rp   r  c                   ,    e Zd ZdZdZdZdZdZdZdZ	dZ
y)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    s8     I J H L L M Nrp   r  c                       e Zd ZdZdZdZy)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 Nrp   r  c                   L    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y)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    sq    4 H
  L J O L  H J J J J I Frp   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   & 	     
 	   " 4CR8  $ 	!       	* #02
/ 
/V:y Vp<
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B1 &#%a && BW%

z'')
) BN2

*
% BN2 C!C!C! JJIIIC  BJJ|,00 ="~ '0 0$h"RHH():VF	(zx	GXR9"Az9 AF:y ( *i  D:y &N Nrp   