
    h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/dS ) 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d0d'Zd( Zd)S )1BaseShapeElementzRProvides common behavior for shape element classes like CT_Shape, CT_Picture, etc.CT_ShapePropertiesspPrreturnr   c                ,    |                      d          S Ncx_get_xfrm_attrselfs    o/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/pptx/oxml/shapes/shared.pyr&   zBaseShapeElement.cx,       ""4(((    c                2    |                      d|           d S r%   _set_xfrm_attrr*   values     r+   r&   zBaseShapeElement.cx0       D%(((((r-   c                ,    |                      d          S Ncyr'   r)   s    r+   r6   zBaseShapeElement.cy4   r,   r-   c                2    |                      d|           d S r5   r/   r1   s     r+   r6   zBaseShapeElement.cy8   r3   r-   c                F    t          |                     d                    S NflipHboolr(   r)   s    r+   r:   zBaseShapeElement.flipH<       D''00111r-   c                2    |                      d|           d S r9   r/   r1   s     r+   r:   zBaseShapeElement.flipH@       GU+++++r-   c                F    t          |                     d                    S NflipVr;   r)   s    r+   rB   zBaseShapeElement.flipVD   r=   r-   c                2    |                      d|           d S rA   r/   r1   s     r+   rB   zBaseShapeElement.flipVH   r?   r-   c                4    | 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+   rE   z BaseShapeElement.get_or_add_xfrmL   s     y((***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     wd""r-   CT_Placeholder | Nonec                f    |                      d          }t          |          dk    rdS |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+   rG   zBaseShapeElement.ph\   s6     **122w<<14qzr-   intc                @    | j         }|t          d          |j        S )zpInteger value of placeholder idx attribute.

        Raises |ValueError| if shape is not a placeholder.
        Nnot a placeholder shape)rG   
ValueErroridxr*   rG   s     r+   ph_idxzBaseShapeElement.ph_idxd   s&     W:6777vr-   strc                @    | j         }|t          d          |j        S )zjPlaceholder orientation, e.g. 'vert'.

        Raises |ValueError| if shape is not a placeholder.
        NrP   )rG   rQ   orientrS   s     r+   	ph_orientzBaseShapeElement.ph_oriento   s'     W:6777yr-   c                @    | j         }|t          d          |j        S )ztPlaceholder size, e.g. ST_PlaceholderSize.HALF.

        Raises `ValueError` if shape is not a placeholder.
        NrP   )rG   rQ   szrS   s     r+   ph_szzBaseShapeElement.ph_szz   s&     W:6777ur-   c                @    | j         }|t          d          |j        S )zPlaceholder type, e.g. ST_PlaceholderType.TITLE ('title').

        Raises `ValueError` if shape is not a placeholder.
        NrP   )rG   rQ   typerS   s     r+   ph_typezBaseShapeElement.ph_type   s&     W:6777wr-   floatc                4    | j         }||j        dS |j        S )z;Float representing degrees this shape is rotated clockwise.N        )xfrmrot)r*   rb   s     r+   rc   zBaseShapeElement.rot   s#     y<48+3xr-   r2   c                8    ||                                  _        d S N)rE   rc   r1   s     r+   rc   zBaseShapeElement.rot   s    %*"""r-   c                $    | j         j        j        S )z*
        Integer id of this shape
        )_nvXxPrcNvPridr)   s    r+   shape_idzBaseShapeElement.shape_id   s    
 |!$$r-   c                $    | j         j        j        S )z$
        Name of this shape
        )rg   rh   namer)   s    r+   
shape_namezBaseShapeElement.shape_name   s    
 |!&&r-   c                F    |                      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                ,    |                      d          S Nxr'   r)   s    r+   rs   zBaseShapeElement.x       ""3'''r-   c                2    |                      d|           d S rr   r/   r1   s     r+   rs   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"   rb   r)   s    r+   rb   zBaseShapeElement.xfrm   s     y~r-   c                ,    |                      d          S Nyr'   r)   s    r+   rz   zBaseShapeElement.y   rt   r-   c                2    |                      d|           d S ry   r/   r1   s     r+   rz   zBaseShapeElement.y   rv   r-   c                8    |                      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   )rK   r)   s    r+   rg   zBaseShapeElement._nvXxPr   s     zz(##A&&r-   rl   Length | Nonec                8    | j         }|d S t          ||          S re   )rb   getattr)r*   rl   rb   s      r+   r(   zBaseShapeElement._get_xfrm_attr   s#    y<4tT"""r-   c                P    |                                  }t          |||           d S re   )rE   setattr)r*   rl   r2   rb   s       r+   r0   zBaseShapeElement._set_xfrm_attr   s+    ##%%dE"""""r-   N)r#   r   )r#   rI   )r#   rN   )r#   rU   )r#   r_   )r2   r_   )rl   rU   r#   r}   )__name__
__module____qualname____doc____annotations__propertyr&   setterr6   r:   rB   rE   rH   rG   rT   rX   r[   r^   rc   rj   rm   rp   rs   rb   rz   rg   r(   r0    r-   r+   r    r    '   s;        \\) ) ) X) Y) ) Y) ) ) ) X) Y) ) Y) 2 2 X2 \, , \, 2 2 X2 \, , \,+ + + # # X#    X    X    X    X   X    X 	Z+ + + Z+ % % X% ' ' X' ) ) X) ( ( ( X( X( ( X(   X ( ( ( X( X( ( X( ' ' X'# # # ## # # # #r-   r    c                  8    e Zd ZU dZded<    edd          ZdS )#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   rG   r   r-   r+   r   r      s@         ////	

 
 
BBBr-   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dS )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                &    | j         }|dS |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     =4|r-   c                d    |                                   |                                 }||_        d S re   )_remove_custDashget_or_add_prstDashr   )r*   r   r   s      r+   r   zCT_LineProperties.prstDash_val   s0    ++--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1H ,OF:F=!!F<  F<  		
 ABB<   y(122,???Hy(122,???H#|SSVV<<<A* * X*   X     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[dS )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      
hlinkHoverri   rl   )r   r   r   r   r   r   r   r   r   r   r   ri   r   rl   r   r-   r+   r   r   '  s         ))55555555;H&/i8TUTVTV<&X&X&XJXXXX&/i8TUTVTV<&X&X&XJXXXX		4!4	5	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<   dS )CT_Placeholderz`p:ph` custom element class.r]   r   r   rW   rU   rZ   rR   r   rN   N)r   r   r   r   r   r   OBJECTr]   r   r   HORZrW   r   FULLrZ   r   rR   r   r-   r+   r   r   5  s         &&,,(=  D     $#,(9  F       *<*A  B     ! ~q  C      r-   r   c                  X    e Zd ZU dZ ede          Zded<    ede          Zded<   dS )
CT_Point2Dz3
    Custom element class for <a:off> element.
    rs   r   rz   N)	r   r   r   r   r   r
   rs   r   rz   r   r-   r+   r   r   F  sZ           "!#}55A5555!!#}55A555555r-   r   c                  B    e Zd ZdZ ede          Z ede          ZdS )CT_PositiveSize2Dz3
    Custom element class for <a:ext> element.
    r&   r6   N)r   r   r   r   r   r   r&   r6   r   r-   r+   r   r   O  s@          
	4!6	7	7B		4!6	7	7BBBr-   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dS ).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]rE   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 | Nonerb   r   r   zCT_CustomGeometry2D | NonecustGeomr      zCT_PresetGeometry2D | NoneprstGeomr   r   r   r   r   r   	   r   
   zCT_LineProperties | Nonelnr      c                ^    |                      d          }|sdS t          |d                   S )zL
        Shape width as an instance of Emu, or None if not present.
        z./a:xfrm/a:ext/@cxNr   rK   r   )r*   
cx_str_lsts     r+   r&   zCT_ShapeProperties.cx  5    
 ZZ 455
 	4:a=!!!r-   c                ^    |                      d          }|sdS 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+   r6   zCT_ShapeProperties.cy  r   r-   r#   r}   c                ^    |                      d          }|sdS 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+   rs   zCT_ShapeProperties.x  5     JJ233	 	49Q<   r-   c                ^    |                      d          }|sdS 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+   rz   zCT_ShapeProperties.y  r   r-   c                (    t          j                    S re   )r   new_gradFillr)   s    r+   _new_gradFillz CT_ShapeProperties._new_gradFill  s    (5777r-   )r#   r}   )r   r   r   r   r   r   r   rb   r   r   r   r   r   r   	effectLstr   r&   r6   rs   rz   r   r   r-   r+   r!   r!   X  sU         
 211122224444((((H" #,)Xabb\# # #D     ,59!"", , ,H     ,59!"", , ,H     (F:F=!!F<  F<  F<  F;	
 ABB<
 
 
 $-98BCC=$ $ $B     	-HRSSMBBBI" " X" " " X" ! ! ! X! ! ! X!8 8 8 8 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dS ) 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   rc   ra   r   zfloat | Noner:   FrB   c                &    | j         }|d S |j        S re   )r   rs   r*   r   s     r+   rs   zCT_Transform2D.x      h;4ur-   c                <    |                                  }||_        d S re   )get_or_add_offrs   r*   r2   r   s      r+   rs   zCT_Transform2D.x      !!##r-   c                &    | j         }|d S |j        S re   )r   rz   r   s     r+   rz   zCT_Transform2D.y  r   r-   c                <    |                                  }||_        d S re   )r   rz   r   s      r+   rz   zCT_Transform2D.y  r   r-   c                &    | j         }|d S |j        S re   )extr&   r*   r   s     r+   r&   zCT_Transform2D.cx      h;4vr-   c                <    |                                  }||_        d S re   )get_or_add_extr&   r*   r2   r   s      r+   r&   zCT_Transform2D.cx      !!##r-   c                &    | j         }|d S |j        S re   )r   r6   r   s     r+   r6   zCT_Transform2D.cy  r   r-   c                <    |                                  }||_        d S re   )r   r6   r   s      r+   r6   zCT_Transform2D.cy  r   r-   c                @    t          d          }d|_        d|_        |S )Nr   r   )r   r&   r6   r   s     r+   _new_extzCT_Transform2D._new_ext  s"    '""
r-   c                @    t          d          }d|_        d|_        |S )Nr   r   )r   rs   rz   r   s     r+   _new_offzCT_Transform2D._new_off  s"    '""
r-   )r   r   r   r   r   r   r   r   r   chOffchExtr   r	   rc   r   r:   rB   r   rs   r   rz   r&   r6   r   r   r   r-   r+   r   r     s          8H&YHQRRL  C     )G
5
5
5CIiHQRRL999EIiHQRRL999E))x  C     gz5AAAEgz5AAAE  X X  X   X X  X   X Y  Y   X Y  Y      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     s6   ( ( " " " " " " * * * * * * * * 3 3 3 3 3 3 + + + + + +                                                     !------SSSSSSSS      r# r# r# r# r# r# r# r#j    /   &5 5 5 5 5 5 5 5p           _   "6 6 6 6 6 6 6 68 8 8 8 8 8 8 8a8 a8 a8 a8 a8 a8 a8 a8HO O O O O_ O O O O Or-   