
    li6                       d Z ddlmZ ddl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  erdd
l!m"Z" ddl#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.    )annotations)TYPE_CHECKINGCallable)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)Emu)CT_Hyperlink)CT_CustomGeometry2DCT_PresetGeometry2D)Lengthc                  `   e Zd ZU dZded<   ed!d       Zej                  d        Zed!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"d       Zed#d       Zed$d       Zed$d       Zed        Zed%d       Zej                  d&d       Zed        Zed        Zed        Zed!d       Zej                  d        Zed        Zed!d       Zej                  d        Zed        Zd'dZd Zy )(BaseShapeElementzRProvides common behavior for shape element classes like CT_Shape, CT_Picture, etc.CT_ShapePropertiesspPrc                $    | j                  d      S Ncx_get_xfrm_attrselfs    U/var/www/html/eduruby.in/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.cx0       D%(r,   c                $    | j                  d      S Ncyr&   r(   s    r*   r5   zBaseShapeElement.cy4   r+   r,   c                (    | j                  d|       y r4   r.   r0   s     r*   r5   zBaseShapeElement.cy8   r2   r,   c                6    t        | j                  d            S NflipHboolr'   r(   s    r*   r9   zBaseShapeElement.flipH<       D''011r,   c                (    | j                  d|       y r8   r.   r0   s     r*   r9   zBaseShapeElement.flipH@       GU+r,   c                6    t        | j                  d            S NflipVr:   r(   s    r*   rA   zBaseShapeElement.flipVD   r<   r,   c                (    | j                  d|       y r@   r.   r0   s     r*   rA   zBaseShapeElement.flipVH   r>   r,   c                6    | j                   j                         S )zReturn 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.
        )r"   get_or_add_xfrmr(   s    r*   rD   z BaseShapeElement.get_or_add_xfrmL   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_elmT   s     wwd""r,   c                L    | j                  d      }t        |      dk(  ry|d   S )z>The `p:ph` descendant element if there is one, None otherwise.z./*[1]/p:nvPr/p:phr   N)xpathlen)r)   ph_elmss     r*   rF   zBaseShapeElement.ph\   s,     **12w<1qzr,   c                L    | j                   }|t        d      |j                  S )zpInteger value of placeholder idx attribute.

        Raises |ValueError| if shape is not a placeholder.
        not a placeholder shape)rF   
ValueErroridxr)   rF   s     r*   ph_idxzBaseShapeElement.ph_idxd   s'     WW:677vvr,   c                L    | j                   }|t        d      |j                  S )zjPlaceholder orientation, e.g. 'vert'.

        Raises |ValueError| if shape is not a placeholder.
        rM   )rF   rN   orientrP   s     r*   	ph_orientzBaseShapeElement.ph_oriento   s(     WW:677yyr,   c                L    | j                   }|t        d      |j                  S )ztPlaceholder size, e.g. ST_PlaceholderSize.HALF.

        Raises `ValueError` if shape is not a placeholder.
        rM   )rF   rN   szrP   s     r*   ph_szzBaseShapeElement.ph_szz   s'     WW:677uur,   c                L    | j                   }|t        d      |j                  S )zPlaceholder type, e.g. ST_PlaceholderType.TITLE ('title').

        Raises `ValueError` if shape is not a placeholder.
        rM   )rF   rN   typerP   s     r*   ph_typezBaseShapeElement.ph_type   s'     WW:677wwr,   c                P    | j                   }||j                  y|j                  S )z;Float representing degrees this shape is rotated clockwise.        )xfrmrot)r)   r]   s     r*   r^   zBaseShapeElement.rot   s'     yy<488+xxr,   c                .    || j                         _        y N)rD   r^   r0   s     r*   r^   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
        )rb   rc   namer(   s    r*   
shape_namezBaseShapeElement.shape_name   s    
 ||!!&&&r,   c                6    | j                  t        d            S )z.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*   rn   zBaseShapeElement.x       ""3''r,   c                (    | j                  d|       y rm   r.   r0   s     r*   rn   zBaseShapeElement.x       C'r,   c                .    | j                   j                  S )zThe `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"   r]   r(   s    r*   r]   zBaseShapeElement.xfrm   s     yy~~r,   c                $    | j                  d      S Nyr&   r(   s    r*   ru   zBaseShapeElement.y   ro   r,   c                (    | j                  d|       y rt   r.   r0   s     r*   ru   zBaseShapeElement.y   rq   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   )rI   r(   s    r*   rb   zBaseShapeElement._nvXxPr   s     zz(#A&&r,   c                8    | j                   }|y t        ||      S r`   )r]   getattr)r)   rg   r]   s      r*   r'   zBaseShapeElement._get_xfrm_attr   s     yy<tT""r,   c                >    | j                         }t        |||       y r`   )rD   setattr)r)   rg   r1   r]   s       r*   r/   zBaseShapeElement._set_xfrm_attr   s    ##%dE"r,   N)returnr   )r|   zCT_Placeholder | None)r|   int)r|   str)r|   float)r1   r   )rg   r~   r|   Length | None)__name__
__module____qualname____doc____annotations__propertyr%   setterr5   r9   rA   rD   rG   rF   rQ   rT   rW   rZ   r^   re   rh   rk   rn   r]   ru   rb   r'   r/    r,   r*   r    r    '   s(   \
) ) YY) ) ) ) YY) ) 2 2 \\, , 2 2 \\, ,+ # #             	ZZ+ + % % ' ' ) ) ( ( XX( (   ( ( XX( ( ' '##r,   r    c                  0    e Zd ZU dZded<    edd      Zy)#CT_ApplicationNonVisualDrawingPropsz`p:nvPr` element.zCallable[[], CT_Placeholder]get_or_add_phzp:ph)z	a:audioCdza:wavAudioFileza:audioFileza:videoFileza:quickTimeFilezp:custDataLstzp:extLst
successorsN)r   r   r   r   r   r   rF   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,   )r   r   r   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                      e Zd ZU dZded<   ded<   dZ ededd 	      Zd
ed<    ededd 	      Zd
ed<    e	de
      Z e	de      Z[y)CT_NonVisualDrawingPropsz`p:cNvPr` custom element class.zCallable[[], CT_Hyperlink]get_or_add_hlinkClickget_or_add_hlinkHover)a:hlinkClicka:hlinkHoverr   r      Nr   zCT_Hyperlink | None
hlinkClickr      
hlinkHoverrd   rg   )r   r   r   r   r   r   r   r   r   r   r   rd   r   rg   r   r,   r*   r   r   '  sf    )5555;H&/8TUTV<&XJ#X&/8TUTV<&XJ#X	4!4	5BVY/Dr,   r   c                      e Zd ZU dZ edeej                        Zded<    ede	e	j                        Zded<    edeej                        Zded<    eded	      Zd
ed<   y)CT_Placeholderz`p:ph` custom element class.rY   r   r   rS   r~   rV   rO   r   r}   N)r   r   r   r   r   r   OBJECTrY   r   r   HORZrS   r   FULLrV   r   rO   r   r,   r*   r   r   5  s    &,(=(=D.  $,(9(9FC    *<*A*AB  !~qC r,   r   c                  J    e Zd ZU dZ ede      Zded<    ede      Zded<   y)
CT_Point2Dz3
    Custom element class for <a:off> element.
    rn   r   ru   N)	r   r   r   r   r   r
   rn   r   ru   r   r,   r*   r   r   F  s+     "#}5Av5!#}5Av5r,   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%   r5   N)r   r   r   r   r   r   r%   r5   r   r,   r*   r   r   O  s#     
4!6	7B	4!6	7Br,   r   c            
         e Zd ZU dZded<   ded<   ded<   ded	<   d
Z ededd       Zded<    ededd       Zded<    ededd       Z	ded<    e
 ed       ed       ed       ed       ed       ed      fedd       Z ed ed!d       Zd"ed#<    ed$ed%d       Z[ed&        Zed'        Zed+d(       Zed)        Zd* Zy),r!   zCustom element class for `p:spPr` element.

    Shared by `p:sp`, `p:cxnSp`,  and `p:pic` elements as well as a few more obscure ones.
    zCallable[[], CT_Transform2D]rD   zCallable[[], CT_LineProperties]get_or_add_lnz!Callable[[], CT_PresetGeometry2D]_add_prstGeomzCallable[[], None]_remove_custGeom)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   zCT_Transform2D | Noner]   r   r   zCT_CustomGeometry2D | NonecustGeomr      zCT_PresetGeometry2D | NoneprstGeomr   r   r   r   r   r   	   r   
   zCT_LineProperties | Nonelnr      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   rI   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*   r5   zCT_ShapeProperties.cy  r   r,   c                F    | j                  d      }|syt        |d         S )zkDistance between the left edge of the slide and left edge of the shape.

        0 if not present.
        z./a:xfrm/a:off/@xNr   r   )r)   	x_str_lsts     r*   rn   zCT_ShapeProperties.x  (     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*   ru   zCT_ShapeProperties.y  r   r,   c                *    t        j                         S r`   )r   new_gradFillr(   s    r*   _new_gradFillz CT_ShapeProperties._new_gradFill  s    (5577r,   )r|   r   )r   r   r   r   r   r   r   r]   r   r   r   r   r   r   	effectLstr   r%   r5   rn   ru   r   r   r,   r*   r!   r!   X  s[   
 212244((H" #,Xab\#D
  ,5!",H(  ,5!",H(  (:=!< < < ;	
 AB<
 $-8BC=$B   -HRSMBI" " " " ! ! ! !8r,   r!   c                     e Zd ZU dZdZ ededd       Zded<    ed	ed
d       Z ededd       Z	 ededd       Z
[ eded      Zded<    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   zCT_Point2D | Noneoffr   r   r   r   r   r   r^   r\   r   zfloat | Noner9   FrA   c                8    | j                   }|y |j                  S r`   )r   rn   r)   r   s     r*   rn   zCT_Transform2D.x      hh;uur,   c                2    | j                         }||_        y r`   )get_or_add_offrn   r)   r1   r   s      r*   rn   zCT_Transform2D.x      !!#r,   c                8    | j                   }|y |j                  S r`   )r   ru   r   s     r*   ru   zCT_Transform2D.y  r   r,   c                2    | j                         }||_        y r`   )r   ru   r   s      r*   ru   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)   r1   r   s      r*   r%   zCT_Transform2D.cx      !!#r,   c                8    | j                   }|y |j                  S r`   )r   r5   r   s     r*   r5   zCT_Transform2D.cy  r   r,   c                2    | j                         }||_        y r`   )r   r5   r   s      r*   r5   zCT_Transform2D.cy  r   r,   c                8    t        d      }d|_        d|_        |S )Nr   r   )r   r%   r5   r   s     r*   _new_extzCT_Transform2D._new_ext  s    '"
r,   c                8    t        d      }d|_        d|_        |S )Nr   r   )r   rn   ru   r   s     r*   _new_offzCT_Transform2D._new_off  s    '"
r,   )r   r   r   r   r   r   r   r   r   chOffchExtr   r	   r^   r   r9   rA   r   rn   r   ru   r%   r5   r   r   r   r,   r*   r   r     sT    8H&HQRLC	  G
5CiHQRL9EiHQRL9E)xC  gz5AEgz5AE  XX    XX    YY    YY r,   r   N)0r   
__future__r   typingr   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   pptx.oxml.actionr   pptx.oxml.shapes.autoshaper   r   r   r    r   r   r   r   r   r   r!   r   r   r,   r*   <module>r     s    ( " * 3 +      -S r# r#j/ &5 5p _ "6 68 8a8 a8HO_ Or,   