
    ,h[U                     f    d dl mZ d dlmZ ddlmZ  G d d      Z G d dej                        Zy	)
    )CommentType)Image   )	xmlwriterc                   <    e Zd ZdZ	 ddedededededefd	Zdd
Zy)
ButtonTypez?
    A class to represent a button in an Excel worksheet.

    Nrowcolheightwidthbutton_numberoptionsc                     || _         || _        || _        || _        d| d| _        d| | _        d| _        d| _        d| _        d| _	        d| _
        g | _        | j                  |       y)a  
        Initialize a ButtonType instance.

        Args:
            row (int): The row number of the button.
            col (int): The column number of the button.
            height (int): The height of the button.
            width (int): The width of the button.
            button_number (int): The button number.
            options (dict): Additional options for the button.
        z
[0]!Button_ClickzButton Nr   r   )r	   r
   r   r   macrocaptiondescriptionx_scaley_scalex_offsety_offsetvertices_set_user_options)selfr	   r
   r   r   r   r   s          P/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/xlsxwriter/vml.py__init__zButtonType.__init__   sy    ( 
!-7
 0 	w'    c                    |y|j                  d| j                        | _        |j                  d| j                        | _        |j                  d| j                        | _        |j                  d| j                        | _        |j                  d| j
                        | _        |j                  d| j                        | _        |j                  d      rd	|d   z   | _        |j                  d
      r| j                  |d
   z  | _        |j                  d      r| j                  |d   z  | _        t        d| j                  z         | _        t        d| j                  z         | _        y)zh
        This method handles the additional optional parameters to
        ``insert_button()``.
        Nr   r   r   r   r   r   r   z[0]!r   r   g      ?)	getr   r   r   r   r   r   r   int)r   r   s     r   r   zButtonType._set_user_optionsC   s$   
 ? [[$**5
kk(DKK8{{9dll;J>J>";;}d6F6FG ;;w''"22DJ ;;y!gi&88DJ;;y!++	(::DK tzz)*
#+,r   N)__name__
__module____qualname____doc__r    dictr   r    r   r   r   r      sQ     %(%( %( 	%(
 %( %( %(N-r   r   c                   >   e Zd ZdZ	 	 	 d1d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efdZdefdZdefdZd Zd Zd Zd ZdefdZd2dedefdZdefd Z def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/d0 Z0y)3Vmlz8
    A class for writing the Excel XLSX Vml file.


    Nc                    d}| j                          | j                  |       |r4| j                          |D ]  }|dz  }| j                  |||       |dz  }! |r4| j	                          |D ]  }|dz  }| j                  |||       |dz  }! |r6| j                          d}	|D ]  }
|dz  }| j                  ||	|
       |	dz  }	! | j                  d       | j                          y )Nr   xml)
_write_xml_namespace_write_shapelayout_write_button_shapetype_write_button_shape_write_comment_shapetype_write_comment_shape_write_image_shapetype_write_image_shape_xml_end_tag
_xml_close)r   data_idvml_shape_idcomments_databuttons_dataheader_imagesz_indexbuttoncommentindeximages              r   _assemble_xml_filezVml._assemble_xml_filew   s    !!# 	(((*& !((wG1	 ))+( !)),I1	 '')E& !''eUC
	 	%  	r   c                 J    |dd \  }}}}|dz  }|dz  }|dz  }|dz  }||||fS )N            ?r'   )r   r   lefttopr   r   s         r   _pixels_to_pointszVml._pixels_to_points   sM     $,Ab> c5& 	t$S%''r   c                 `    d}|dz   }|dz   }|dz   }d|fd|fd|fg}| j                  d|       y )	Nzurn:schemas-microsoft-com:vmlzoffice:officezoffice:excelzxmlns:vzxmlns:ozxmlns:xr+   )_xml_start_tag)r   schemaxmlnsxmlns_oxmlns_x
attributess         r   r,   zVml._write_xml_namespace   sW    -?*>)   

 	E:.r   c                 r    dg}| j                  d|       | j                  |       | j                  d       y )Nv:exteditzo:shapelayout)rJ   _write_idmapr4   r   r6   rO   s      r   r-   zVml._write_shapelayout   s8    '(
OZ8 	'"/*r   c                 4    dd|fg}| j                  d|       y )NrQ   datazo:idmap_xml_empty_tagrU   s      r   rT   zVml._write_idmap   s(     W


 	Iz2r   c                     d}d}d}d}d|fd|fd|fd|fg}| j                  d	|       | j                          | j                  d
d       | j                  d	       y )N_x0000_t20221600,21600   m,l,21600r21600,l21600,xeid	coordsizeo:sptpathv:shapetypetrect)rJ   _write_stroke_write_comment_pathr4   r   shape_idr`   sptrb   rO   s         r   r0   zVml._write_comment_shapetype   s}     !	* 8)$cNTN	

 	M:6 	 	  f--(r   c                     d}d}d}d}d|fd|fd|fd|fg}| j                  d	|       | j                          | j                          | j                          | j	                  d	       y )
N_x0000_t201r\      r^   r_   r`   ra   rb   rc   )rJ   rf   _write_button_path_write_shapetype_lockr4   rh   s         r   r.   zVml._write_button_shapetype   s     !	* 8)$cNTN	

 	M:6 	 	! 	""$-(r   c                    d}d}d}d}d}d}d}d|fd|fd	|fd
|fd|fd|fd|fg}| j                  d|       | j                          | j                          | j                          | j	                          | j                  d       y )N
_x0000_t75r\   K   rd   zm@4@5l@4@11@9@11@9@5xefr_   r`   ra   zo:preferrelativerb   filledstrokedrc   )rJ   rf   _write_formulas_write_image_path_write_aspect_ratio_lockr4   )	r   ri   r`   rj   o_preferrelativerb   rt   ru   rO   s	            r   r2   zVml._write_image_shapetype  s    !	' 8)$cN!12TNv 

 	M:6 	 	 	  	%%'-(r   c                 6    d}d|fg}| j                  d|       y )Nmiter	joinstylezv:strokerX   )r   r|   rO   s      r   rf   zVml._write_stroke7  s$    	"I./
J
3r   c                 x    g }|r|j                  d       |j                  d|f       | j                  d|       y )N)gradientshapeokrd   o:connecttypev:path)appendrY   )r   r~   connecttyperO   s       r   rg   zVml._write_comment_path?  s<    
67?K89Hj1r   c                 ^    d}d}d}d}d}d|fd|fd|fd|fd|fg}| j                  d|       y )	Nrs   re   shadowoko:extrusionokstrokeokfillokr   r   rX   )r   r   extrusionokr   r   r   rO   s          r   rn   zVml._write_button_pathJ  s^     "k*"vk*

 	Hj1r   c                 J    d}d}d}d|fd|fd|fg}| j                  d|       y )Nrs   rd   re   r   r~   r   r   rX   )r   r   r~   r   rO   s        r   rw   zVml._write_image_path\  sD     k*0k*

 	Hj1r   c                 @    d}d}d|fd|fg}| j                  d|       y )NrS   rd   rR   	shapetypeo:lockrX   )r   extr   rO   s       r   ro   zVml._write_shapetype_lockj  s6    	 cN)$


 	Hj1r   c                 @    d}d}d|fd|fg}| j                  d|       y )NrS   rd   rR   rotationr   rX   )r   r   r   rO   s       r   _write_rotation_lockzVml._write_rotation_lockv  s6     cN"


 	Hj1r   c                 @    d}d}d|fd|fg}| j                  d|       y )NrS   rd   rR   aspectratior   rX   )r   r   r   rO   s       r   rx   zVml._write_aspect_ratio_lock  s6     cNK(


 	Hj1r   r=   c                    d}d}d}dt        |      z   }| j                  |j                        \  }}}	}
|j                  rd}d|dd|dd	|	dd
|
dd| d| }d|fd|fd|fd|j                  fd|fg}| j                  d|       | j                          | j                          | j                  d d       | j                          | j                  |       | j                  d       y )Nz#_x0000_t202autohidden_x0000_svisibleposition:absolute;margin-left:.15gpt;margin-top:	pt;width:
pt;height:pt;z-index:z;visibility:r_   typestyle	fillcoloro:insetmodev:shapenone)strrG   r   
is_visiblecolorrJ   _write_comment_fill_write_shadowrg   _write_comment_textbox_write_comment_client_datar4   )r   ri   r;   r=   
shape_type	insetmode
visibilityrE   rF   r   r   r   rO   s                r   r1   zVml._write_comment_shape  s?   #
	
 H-%)%;%;G<L<L%M"sE6 "J+ &d $4L !T] #i  $' 	 8Z e'--(I&

 	Iz2 	  " 	 	  v. 	##% 	''0)$r   r<   c                 j   d}dt        |      z   }| j                  |j                        \  }}}}d|dd|dd|dd|dd| d	}	d
|fd|fg}
|j                  |
j	                  d|j                  f       |
j	                  d|	f       |
j	                  d       |
j	                  d       |
j	                  d       |
j	                  d       | j                  d|
       | j                          | j                          | j                  |       | j                  |       | j                  d       y )Nz#_x0000_t201r   r   r   r   r   r   r   z;mso-wrap-style:tightr_   r   altr   )zo:buttonrd   )r   buttonFace [67])strokecolorzwindowText [64])r   r   r   )r   rG   r   r   r   rJ   _write_button_fillr   _write_button_textbox_write_button_client_datar4   )r   ri   r;   r<   r   rE   rF   r   r   r   rO   s              r   r/   zVml._write_button_shape  sf   #
 H-%)%;%;FOO%L"sE6+ &d $4L !T] #i  #$ 	 8Z 


 )uf&8&89:7E*++,:;<=12Iz2 	! 	!!# 	""6* 	&&v.)$r   r?   c                    d}dt        |      z   }|j                  }|j                  }|j                  }|j                  }|j
                  }	|j                  }
|j                  }|dz  |z  }|	dz  |z  }	dt        |dz  dz  dz         z  }dt        |	dz  dz  dz         z  }	d|d	d
|	d	d| }d|fd|fd|fd|fg}| j                  d|       | j                  |
|       | j                          | j                  d       y )Nz#_x0000_t75r   g      R@rD   g      X@H   g      ?z3position:absolute;margin-left:0;margin-top:0;width:r   r   r   r_   zo:spidr   r   r   )r   
image_name_width_x_dpi_y_dpi_height_ref_id_header_positionr    rJ   _write_imagedatar   r4   )r   ri   r;   r?   r   namer   x_dpiy_dpir   ref_idpositionr   rO   s                 r   r3   zVml._write_image_shape  sM   "
 H- )) u$$& Cr 1D 899S$!3d!:;; 4L !T] #i! 	 8x Z e	

 	Iz2 	fd+ 	!!#)$r   c                 6    d}d|fg}| j                  d|       y )Nz#ffffe1color2v:fillrX   )r   color_2rO   s      r   r   zVml._write_comment_fill%  s$    )*
Hj1r   c                 @    d}d}d|fd|fg}| j                  d|       y )Nr   rd   r   zo:detectmouseclickr   rX   )r   r   detectmouseclickrO   s       r   r   zVml._write_button_fill-  s9    # w!#34


 	Hj1r   c                 J    d}d}d}d|fd|fd|fg}| j                  d|       y )Nrd   blackonr   obscuredzv:shadowrX   )r   r   r   r   rO   s        r   r   zVml._write_shadow9  sC     2Je"

 	J
3r   c                 z    d}d|fg}| j                  d|       | j                  d       | j                  d       y )Nmso-direction-alt:autor   	v:textboxrE   )rJ   
_write_divr4   )r   r   rO   s      r   r   zVml._write_comment_textboxG  s@    (&'
K4 	+&r   c                     d}d|fdg}| j                  d|       | j                  d|j                         | j                  d       y )Nr   r   )zo:singleclickrs   r   center)rJ   r   r   r4   )r   r<   r   rO   s       r   r   zVml._write_button_textboxT  sI    (&(>?
K4 	&..1+&r   alignr   c                     d|z   }d|fg}| j                  d|       |r| j                  |       | j                  d       y )Nztext-align:r   div)rJ   _write_button_fontr4   )r   r   r   r   rO   s        r   r   zVml._write_diva  sJ     %&'
E:.##G,% r   c                 L    d}d}d}d|fd|fd|fg}| j                  d||       y )NCalibri   z#000000facesizer   font_xml_data_element)r   r   r   r   r   rO   s         r   r   zVml._write_button_fonto  sD     TNTNe

 	vw
;r   c                    d}d|fg}| j                  d|       | j                          | j                          | j                  |j                         | j                          | j                  |j                         | j                  |j                         |j                  r| j                          | j                  d       y )NNote
ObjectTypex:ClientData)rJ   _write_move_with_cells_write_size_with_cells_write_anchorr   _write_auto_fill
_write_rowr	   _write_columnr
   r   _write_visibler4   )r   r=   object_typerO   s       r   r   zVml._write_comment_client_data}  s    #[12
NJ7 	##% 	##% 	7++, 	 	$ 	7;;' !.)r   c                 D   d}d|fg}| j                  d|       | j                  |j                         | j                          | j	                          | j                  |j                         | j                          | j                          | j                  d       y )NButtonr   r   )
rJ   r   r   _write_print_objectr   _write_fmla_macror   _write_text_halign_write_text_valignr4   )r   r<   r   rO   s       r   r   zVml._write_button_client_data  s    #[12
NJ7 	6??+ 	  " 	 	v||, 	! 	!.)r   c                 &    | j                  d       y )Nzx:MoveWithCellsrX   r   s    r   r   zVml._write_move_with_cells      -.r   c                 &    | j                  d       y )Nzx:SizeWithCellsrX   r   s    r   r   zVml._write_size_with_cells  r   r   c                 &    | j                  d       y )Nz	x:VisiblerX   r   s    r   r   zVml._write_visible  s    K(r   c                     |d d \  }}}}}}}}	||||||||	g}
|
D cg c]  }t        |       }
}dj                  |
      }| j                  d|       y c c}w )NrB   z, zx:Anchor)r   joinr   )r   r   	col_start	row_startx1y1col_endrow_endx2y2stringsirW   s                r   r   zVml._write_anchor  sn    CKBQ<@Ir2wRb)R"grJ#*+a3q6++yy!z40	 ,s   Ac                 ,    d}| j                  d|       y )NFalsez
x:AutoFillr   r   rW   s     r   r   zVml._write_auto_fill  s    |T2r   c                 (    | j                  d|       y )Nzx:Rowr   r  s     r   r   zVml._write_row  s    w-r   c                 (    | j                  d|       y )Nzx:Columnr   r  s     r   r   zVml._write_column  s    z40r   c                 (    | j                  dd       y )Nzx:PrintObjectr  r   r   s    r   r   zVml._write_print_object  s    8r   c                 (    | j                  dd       y )Nzx:TextHAlignCenterr   r   s    r   r   zVml._write_text_halign      ~x8r   c                 (    | j                  dd       y )Nzx:TextVAlignr
  r   r   s    r   r   zVml._write_text_valign  r  r   c                 (    | j                  d|       y )Nzx:FmlaMacror   r  s     r   r   zVml._write_fmla_macro  s    }d3r   c                 P    ddt        |      z   fd|fg}| j                  d|       y )Nzo:relidrIdzo:titlezv:imagedata)r   rY   )r   r   o_titlerO   s       r   r   zVml._write_imagedata  s6     F+, 


 	M:6r   c                    | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       | j                  d	       | j                  d
       | j                  d       | j                  d       | j                  d       | j                  d       y )Nz
v:formulaszif lineDrawn pixelLineWidth 0z
sum @0 1 0z
sum 0 0 @1zprod @2 1 2zprod @3 21600 pixelWidthzprod @3 21600 pixelHeightz
sum @0 0 1zprod @6 1 2zprod @7 21600 pixelWidthzsum @8 21600 0zprod @7 21600 pixelHeightzsum @10 21600 0)rJ   _write_formular4   r   s    r   rv   zVml._write_formulas  s    L) 	;<L)L)M*6778L)M*67,-78-.,'r   c                 2    d|fg}| j                  d|       y )Neqnzv:frX   )r   r  rO   s      r   r  zVml._write_formula  s    cl^
E:.r   )NNNr!   )1r"   r#   r$   r%   r@   rG   r,   r-   rT   r0   r.   r2   rf   rg   rn   rw   ro   r   rx   r   r1   r   r/   r   r3   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rv   r  r'   r   r   r)   r)   k   s    2h($/	+3)0)6")H4	22$2
2
2
22%{ 2%h/%Z /%b0%5 0%d2
24''J '! !c !<# <*+ *@*8//)	13.199947((/r   r)   N)	xlsxwriter.commentsr   xlsxwriter.imager    r   r   	XMLwriterr)   r'   r   r   <module>r     s1    , " K- K-jd
/)

 d
/r   