
    ,h1                     j   d Z ddlmZmZmZmZ ddlmZ ddlm	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 ddlmZmZmZmZmZmZmZ ddlm Z   G d	 d
e      Z! G d de      Z" G d de      Z# G d de      Z$ G d de      Z% G d de      Z& G d de      Z' G d de      Z( G d de      Z)y)z"Common shape-related oxml objects.    )absolute_importdivisionprint_functionunicode_literals)CT_GradientFillProperties)PP_PLACEHOLDER)qn)
ST_AngleST_CoordinateST_DirectionST_DrawingElementIdST_LineWidthST_PlaceholderSizeST_PositiveCoordinate
XsdBoolean	XsdStringXsdUnsignedInt)BaseOxmlElementChoiceOptionalAttributeOxmlElementRequiredAttribute	ZeroOrOneZeroOrOneChoice)Emuc                   >   e Zd ZdZed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zed        Z	e	j                  d	        Z	d
 Z
ed        Zed        Zed        Zed        Zed        Zed        Zed        Zej                  d        Zed        Zed        Zed        Zed        Zej                  d        Zed        Zed        Zej                  d        Zed        Zd Zd Zy)BaseShapeElementz`
    Provides common behavior for shape element classes like CT_Shape,
    CT_Picture, etc.
    c                 $    | j                  d      S Ncx_get_xfrm_attrselfs    Y/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/oxml/shapes/shared.pyr    zBaseShapeElement.cx(       ""4((    c                 (    | j                  d|       y r   _set_xfrm_attrr$   values     r%   r    zBaseShapeElement.cx,       D%(r'   c                 $    | j                  d      S Ncyr!   r#   s    r%   r0   zBaseShapeElement.cy0   r&   r'   c                 (    | j                  d|       y r/   r)   r+   s     r%   r0   zBaseShapeElement.cy4   r-   r'   c                 6    t        | j                  d            S NflipHboolr"   r#   s    r%   r4   zBaseShapeElement.flipH8       D''011r'   c                 (    | j                  d|       y r3   r)   r+   s     r%   r4   zBaseShapeElement.flipH<       GU+r'   c                 6    t        | j                  d            S NflipVr5   r#   s    r%   r<   zBaseShapeElement.flipV@   r7   r'   c                 (    | j                  d|       y r;   r)   r+   s     r%   r<   zBaseShapeElement.flipVD   r9   r'   c                 6    | j                   j                         S )z
        Return the ``<a:xfrm>`` grandchild element, newly-added if not
        present. This version works for ``<p:sp>``, ``<p:cxnSp>``, and
        ``<p:pic>`` elements, others will need to override.
        )spPrget_or_add_xfrmr#   s    r%   r@   z BaseShapeElement.get_or_add_xfrmH   s     yy((**r'   c                     | j                   duS )z
        True if this shape element has a ``<p:ph>`` descendant, indicating it
        is a placeholder shape. False otherwise.
        N)phr#   s    r%   
has_ph_elmzBaseShapeElement.has_ph_elmP   s     wwd""r'   c                 L    | j                  d      }t        |      dk(  ry|d   S )zT
        The ``<p:ph>`` descendant element if there is one, None otherwise.
        z./*[1]/p:nvPr/p:phr   N)xpathlen)r$   ph_elmss     r%   rB   zBaseShapeElement.phX   s,    
 **12w<1qzr'   c                 L    | j                   }|t        d      |j                  S )zx
        Integer value of placeholder idx attribute. Raises |ValueError| if
        shape is not a placeholder.
        not a placeholder shape)rB   
ValueErroridxr$   rB   s     r%   ph_idxzBaseShapeElement.ph_idxb   s'     WW:677vvr'   c                 L    | j                   }|t        d      |j                  S )zr
        Placeholder orientation, e.g. 'vert'. Raises |ValueError| if shape is
        not a placeholder.
        rI   )rB   rJ   orientrL   s     r%   	ph_orientzBaseShapeElement.ph_orientm   s(     WW:677yyr'   c                 L    | j                   }|t        d      |j                  S )zu
        Placeholder size, e.g. ST_PlaceholderSize.HALF, None if shape has no
        ``<p:ph>`` descendant.
        rI   )rB   rJ   szrL   s     r%   ph_szzBaseShapeElement.ph_szx   s'     WW:677uur'   c                 L    | j                   }|t        d      |j                  S )z
        Placeholder type, e.g. ST_PlaceholderType.TITLE ('title'), none if
        shape has no ``<p:ph>`` descendant.
        rI   )rB   rJ   typerL   s     r%   ph_typezBaseShapeElement.ph_type   s'     WW:677wwr'   c                 8    | j                   }|y|j                  S )zM
        Float representing degrees this shape is rotated clockwise.
                )xfrmrot)r$   rY   s     r%   rZ   zBaseShapeElement.rot   s    
 yy<xxr'   c                 .    || j                         _        y N)r@   rZ   r+   s     r%   rZ   zBaseShapeElement.rot   s    %*"r'   c                 B    | j                   j                  j                  S )z*
        Integer id of this shape
        )_nvXxPrcNvPridr#   s    r%   shape_idzBaseShapeElement.shape_id   s    
 ||!!$$$r'   c                 B    | j                   j                  j                  S )z$
        Name of this shape
        )r^   r_   namer#   s    r%   
shape_namezBaseShapeElement.shape_name   s    
 ||!!&&&r'   c                 6    | j                  t        d            S )zC
        Child ``<p:txBody>`` element, None if not present
        zp:txBody)findr	   r#   s    r%   txBodyzBaseShapeElement.txBody   s    
 yyJ((r'   c                 $    | j                  d      S Nxr!   r#   s    r%   rj   zBaseShapeElement.x       ""3''r'   c                 (    | j                  d|       y ri   r)   r+   s     r%   rj   zBaseShapeElement.x       C'r'   c                 .    | j                   j                  S )z
        The ``<a:xfrm>`` grandchild element or |None| if not found. This
        version works for ``<p:sp>``, ``<p:cxnSp>``, and ``<p:pic>``
        elements, others will need to override.
        )r?   rY   r#   s    r%   rY   zBaseShapeElement.xfrm   s     yy~~r'   c                 $    | j                  d      S Nyr!   r#   s    r%   rq   zBaseShapeElement.y   rk   r'   c                 (    | j                  d|       y rp   r)   r+   s     r%   rq   zBaseShapeElement.y   rm   r'   c                 *    | j                  d      d   S )z
        Required non-visual shape properties element for this shape. Actual
        name depends on the shape type, e.g. ``<p:nvPicPr>`` for picture
        shape.
        z./*[1]r   )rE   r#   s    r%   r^   zBaseShapeElement._nvXxPr   s     zz(#A&&r'   c                 8    | j                   }|y t        ||      S r\   )rY   getattr)r$   rc   rY   s      r%   r"   zBaseShapeElement._get_xfrm_attr   s     yy<tT""r'   c                 >    | j                         }t        |||       y r\   )r@   setattr)r$   rc   r,   rY   s       r%   r*   zBaseShapeElement._set_xfrm_attr   s    ##%dE"r'   N)__name__
__module____qualname____doc__propertyr    setterr0   r4   r<   r@   rC   rB   rM   rP   rS   rV   rZ   ra   rd   rg   rj   rY   rq   r^   r"   r*    r'   r%   r   r   "   s&   
 ) ) YY) ) ) ) YY) ) 2 2 \\, , 2 2 \\, ,+ # #             	ZZ+ + % % ' ' ) ) ( ( XX( (   ( ( XX( ( ' '##r'   r   c                   $    e Zd ZdZ edd      Zy)#CT_ApplicationNonVisualDrawingPropsz
    ``<p:nvPr>`` element
    zp:ph)z	a:audioCdza:wavAudioFileza:audioFileza:videoFileza:quickTimeFilezp:custDataLstzp:extLst
successorsN)rx   ry   rz   r{   r   rB   r~   r'   r%   r   r      s     


Br'   r   c                      e Zd ZdZdZ e ed       ed       ed       ed      fedd 	      Z ed
edd 	      Z	 ededd 	      Z
[ ede ed            Zed        Zed        Zej$                  d        Zy)CT_LinePropertiesz'Custom element class for <a:ln> element)a:noFilla:solidFill
a:gradFill
a:pattFill
a:prstDash
a:custDashza:roundza:bevelza:miterz	a:headEndz	a:tailEnda:extLstr   r   r   r      Nr   r      r      wr   defaultc                     | j                   S )zE
        Required to fulfill the interface used by dml.fill.
        )eg_lineFillPropertiesr#   s    r%   eg_fillPropertiesz#CT_LineProperties.eg_fillProperties  s    
 )))r'   c                 8    | j                   }|y|j                  S )zfReturn value of `val` attribute of `a:prstDash` child.

        Return |None| if not present.
        N)prstDashval)r$   r   s     r%   prstDash_valzCT_LineProperties.prstDash_val  s      ==||r'   c                 R    | j                          | j                         }||_        y r\   )_remove_custDashget_or_add_prstDashr   )r$   r   r   s      r%   r   zCT_LineProperties.prstDash_val"  s#    ++-r'   )rx   ry   rz   r{   _tag_seqr   r   r   r   r   custDashr   r   r   r   r|   r   r   r}   r~   r'   r%   r   r      s    1H ,:=!< < 		
 AB< (12,?H(12,?H#|SV<A* *    r'   r   c                   n    e Zd ZdZdZ ededd       Z ededd       Z ed	e	      Z
 ed
e      Z[y)CT_NonVisualDrawingPropsz-
    ``<p:cNvPr>`` custom element class.
    )a:hlinkClicka:hlinkHoverr   r      Nr   r      r`   rc   )rx   ry   rz   r{   r   r   
hlinkClick
hlinkHoverr   r   r`   r   rc   r~   r'   r%   r   r   )  sN     <H>hqrlCJ>hqrlCJ	4!4	5BVY/Dr'   r   c                       e Zd ZdZ edeej                        Z edeej                        Z
 edeej                        Z eded      Zy)	CT_Placeholderz*
    ``<p:ph>`` custom element class.
    rU   r   rO   rR   rK   r   N)rx   ry   rz   r{   r   r   OBJECTrU   r   HORZrO   r   FULLrR   r   rK   r~   r'   r%   r   r   6  sU     V^^=R=RSDx|?P?PQF	4!3=O=T=T	UB
E>1
=Cr'   r   c                   4    e Zd ZdZ ede      Z ede      Zy)
CT_Point2Dz3
    Custom element class for <a:off> element.
    rj   rq   N)rx   ry   rz   r{   r   r   rj   rq   r~   r'   r%   r   r   A  s!     	#}-A#}-Ar'   r   c                   4    e Zd ZdZ ede      Z ede      Zy)CT_PositiveSize2Dz3
    Custom element class for <a:ext> element.
    r    r0   N)rx   ry   rz   r{   r   r   r    r0   r~   r'   r%   r   r   J  s#     
4!6	7B	4!6	7Br'   r   c            
       L   e Zd ZdZdZ ededd       Z ededd       Z ed	ed
d       Z e	 e
d       e
d       e
d       e
d       e
d       e
d      fedd       Z ededd       Z ededd       Z[ed        Zed        Zed        Zed        Zd Zy)CT_ShapePropertieszCustom element class for `p:spPr` element.

    Shared by `p:sp`, `p:cxnSp`,  and `p:pic` elements as well as a few more
    obscure ones.
    )a:xfrm
a:custGeom
a:prstGeomr   r   r   
a:blipFillr   	a:grpFilla:lna:effectLstza:effectDagz	a:scene3dza:sp3dr   r   r   Nr   r   r   r      r   r   r   r   r   r   	   r   
   r      c                 F    | j                  d      }|syt        |d         S )zL
        Shape width as an instance of Emu, or None if not present.
        z./a:xfrm/a:ext/@cxNr   rE   r   )r$   
cx_str_lsts     r%   r    zCT_ShapeProperties.cx}  (    
 ZZ 45
:a=!!r'   c                 F    | j                  d      }|syt        |d         S )zM
        Shape height as an instance of Emu, or None if not present.
        z./a:xfrm/a:ext/@cyNr   r   )r$   
cy_str_lsts     r%   r0   zCT_ShapeProperties.cy  r   r'   c                 F    | j                  d      }|syt        |d         S )z
        The offset of the left edge of the shape from the left edge of the
        slide, as an instance of Emu. Corresponds to the value of the
        `./xfrm/off/@x` attribute. None if not present.
        z./a:xfrm/a:off/@xNr   r   )r$   	x_str_lsts     r%   rj   zCT_ShapeProperties.x  s(     JJ23	9Q<  r'   c                 F    | j                  d      }|syt        |d         S )z
        The offset of the top of the shape from the top of the slide, as an
        instance of Emu. None if not present.
        z./a:xfrm/a:off/@yNr   r   )r$   	y_str_lsts     r%   rq   zCT_ShapeProperties.y  s(     JJ23	9Q<  r'   c                 *    t        j                         S r\   )r   new_gradFillr#   s    r%   _new_gradFillz CT_ShapeProperties._new_gradFill  s    (5577r'   )rx   ry   rz   r{   r   r   rY   custGeomprstGeomr   r   r   ln	effectLstr|   r    r0   rj   rq   r   r~   r'   r%   r   r   S  s   H" X(12,7D(12,?H(12,?H':=!< < < ;	
 AB<
 
6hrsm	4B-HRSMBI" " " " 	! 	! ! !8r'   r   c                      e Zd ZdZdZ ededd       Z ededd       Z ed	ed
d       Z ededd       Z	[ e
ded      Z e
ded      Z e
ded      Zed        Zej$                  d        Zed        Zej$                  d        Zed        Zej$                  d        Zed        Zej$                  d        Zd Zd Zy)CT_Transform2Dz`a:xfrm` custom element class.

    NOTE: this is a composite including CT_GroupTransform2D, which appears
    with the `a:xfrm` tag in a group shape (including a slide `p:spTree`).
    )a:offa:exta:chOffa:chExtr   r   Nr   r   r   r   r   r   r   rZ   rX   r   r4   Fr<   c                 8    | j                   }|y |j                  S r\   )offrj   r$   r   s     r%   rj   zCT_Transform2D.x      hh;uur'   c                 2    | j                         }||_        y r\   )get_or_add_offrj   r$   r,   r   s      r%   rj   zCT_Transform2D.x      !!#r'   c                 8    | j                   }|y |j                  S r\   )r   rq   r   s     r%   rq   zCT_Transform2D.y  r   r'   c                 2    | j                         }||_        y r\   )r   rq   r   s      r%   rq   zCT_Transform2D.y  r   r'   c                 8    | j                   }|y |j                  S r\   )extr    r$   r   s     r%   r    zCT_Transform2D.cx      hh;vvr'   c                 2    | j                         }||_        y r\   )get_or_add_extr    r$   r,   r   s      r%   r    zCT_Transform2D.cx      !!#r'   c                 8    | j                   }|y |j                  S r\   )r   r0   r   s     r%   r0   zCT_Transform2D.cy  r   r'   c                 2    | j                         }||_        y r\   )r   r0   r   s      r%   r0   zCT_Transform2D.cy  r   r'   c                 8    t        d      }d|_        d|_        |S )Nr   r   )r   r    r0   r   s     r%   _new_extzCT_Transform2D._new_ext  s    '"
r'   c                 8    t        d      }d|_        d|_        |S )Nr   r   )r   rj   rq   r   s     r%   _new_offzCT_Transform2D._new_off  s    '"
r'   )rx   ry   rz   r{   r   r   r   r   chOffchExtr   r
   rZ   r   r4   r<   r|   rj   r}   rq   r    r0   r   r   r~   r'   r%   r   r     s;    8H
G
5C
G
5CiHQRL9EiHQRL9E
E8S
9Cgz5AEgz5AE  XX    XX    YY    YY r'   r   N)*r{   
__future__r   r   r   r   pptx.dml.fillr   pptx.enum.shapesr   pptx.oxml.nsr	   pptx.oxml.simpletypesr
   r   r   r   r   r   r   r   r   r   pptx.oxml.xmlchemyr   r   r   r   r   r   r   	pptx.utilr   r   r   r   r   r   r   r   r   r   r~   r'   r%   <module>r      s    ) R R 3 +      y# y#x/ &5 5p
 
>_ >. .8 8V8 V8rK_ Kr'   