
    hi"                    f   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mZmZmZmZmZ ddlmZmZmZmZmZ er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! 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 ),zDCustom element classes for shape-related elements like `<w:inline>`.    )annotations)TYPE_CHECKINGcastnsdecls)	parse_xml)ST_CoordinateST_DrawingElementIdST_PositiveCoordinateST_RelationshipId	XsdStringXsdToken)BaseOxmlElementOneAndOnlyOneOptionalAttributeRequiredAttribute	ZeroOrOne)Lengthc                      e Zd ZdZdS )	CT_Anchorz8`<wp:anchor>` element, container for a "floating" shape.N__name__
__module____qualname____doc__     g/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/docx/oxml/shape.pyr   r      s        BBBBr   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_BlipzX``<a:blip>`` element, specifies image source and adjustments such as alpha and
    tint.zr:embedz
str | Noneembedzr:linklinkN)	r   r   r   r   r   r   r!   __annotations__r"   r   r   r   r    r    !   s|           *)$ E     )(# D      r   r    c                  8    e Zd ZU dZ edd          Zded<   dS )CT_BlipFillPropertiesz9``<pic:blipFill>`` element, specifies picture properties.za:blip)z	a:srcRectza:tilez	a:stretch
successorsr    blipN)r   r   r   r   r   r(   r#   r   r   r   r%   r%   -   sL         CCIA  D      r   r%   c                  4    e Zd ZU dZ ed          Zded<   dS )CT_GraphicalObjectz:``<a:graphic>`` element, container for a DrawingML object.za:graphicDataCT_GraphicalObjectDatagraphicDataN)r   r   r   r   r   r,   r#   r   r   r   r*   r*   5   sD         DD*7-+ +K      r   r*   c                  V    e Zd ZU dZ ed          Zded<    ede          Z	ded<   dS )r+   zI``<a:graphicData>`` element, container for the XML of a DrawingML object.zpic:pic
CT_PicturepicuristrN)
r   r   r   r   r   r/   r#   r   r   r0   r   r   r   r+   r+   =   sQ         SSi	**C****  11C111111r   r+   c                      e Zd ZU dZ ed          Zded<    ed          Zded<    ed          Zd	ed
<   e	dd            Z
e	dd            Ze	d             ZdS )	CT_Inlinez5`<wp:inline>` element, container for an inline shape.z	wp:extentCT_PositiveSize2Dextentzwp:docPrCT_NonVisualDrawingPropsdocPrz	a:graphicr*   graphiccxr   cyshape_idintr/   r.   returnc                4   t          t          t          |                                                     }||j        _        ||j        _        ||j        _        d|z  |j        _	        d|j
        j        _        |j
        j                            |           |S )z\Return a new ``<wp:inline>`` element populated with the values passed as
        parameters.z
Picture %dz8http://schemas.openxmlformats.org/drawingml/2006/picture)r   r3   r   _inline_xmlr5   r9   r:   r7   idnamer8   r,   r0   _insert_pic)clsr9   r:   r;   r/   inlines         r   newzCT_Inline.newO   s|     i3??+<+<!=!=>>"(83)c"&"..s333r   rIdr1   filenamec                v    d}t                               |||||          }|                     ||||          }|S )zCreate `wp:inline` element containing a `pic:pic` element.

        The contents of the `pic:pic` element is taken from the argument values.
        r   )r.   rE   )	rC   r;   rF   rG   r9   r:   pic_idr/   rD   s	            r   new_pic_inlinezCT_Inline.new_pic_inline\   s>     nnVXsB;;R3//r   c                ,    dt          dddd          z  S )Na  <wp:inline %s>
  <wp:extent cx="914400" cy="914400"/>
  <wp:docPr id="666" name="unnamed"/>
  <wp:cNvGraphicFramePr>
    <a:graphicFrameLocks noChangeAspect="1"/>
  </wp:cNvGraphicFramePr>
  <a:graphic>
    <a:graphicData uri="URI not set"/>
  </a:graphic>
</wp:inline>wpar/   rr   rC   s    r   r?   zCT_Inline._inline_xmli   s$    	 %T3s;;	<	
r   N)
r9   r   r:   r   r;   r<   r/   r.   r=   r3   )r;   r<   rF   r1   rG   r1   r9   r   r:   r   r=   r3   )r   r   r   r   r   r5   r#   r7   r8   classmethodrE   rJ   r?   r   r   r   r3   r3   D   s         ?? -k : :F::::&3m' 'E     #0-# #G     
 
 
 [
 
 
 
 [
 
 
 [
 
 
r   r3   c                  B    e Zd ZdZ ede          Z ede          ZdS )r6   zpUsed for ``<wp:docPr>`` element, and perhaps others.

    Specifies the id and name of a DrawingML drawing.
    r@   rA   N)	r   r   r   r   r   r
   r@   r   rA   r   r   r   r6   r6   y   s?         
 
	4!4	5	5BVY//DDDr   r6   c                      e Zd ZdZdS )CT_NonVisualPicturePropertieszK``<pic:cNvPicPr>`` element, specifies picture locking and resize behaviors.Nr   r   r   r   rS   rS      s        UUUUr   rS   c                      e Zd ZU dZ ed          Zded<    ed          Zded<    ed          Zd	ed
<   e	dd            Z
e	d             ZdS )r.   z+``<pic:pic>`` element, a DrawingML picture.zpic:nvPicPrCT_PictureNonVisualnvPicPrzpic:blipFillr%   blipFillzpic:spPrCT_ShapePropertiesspPrrI   r<   rG   r1   rF   r9   r   r:   r=   c                    t          |                                           }||j        j        _        ||j        j        _        ||j        j        _        ||j	        _
        ||j	        _        |S )z3A new minimum viable `<pic:pic>` (picture) element.)r   _pic_xmlrV   cNvPrr@   rA   rW   r(   r!   rY   r9   r:   )rC   rI   rG   rF   r9   r:   r/   s          r   rE   zCT_Picture.new   sW     ''%!)"%
r   c                *    dt          ddd          z  S )Naq  <pic:pic %s>
  <pic:nvPicPr>
    <pic:cNvPr id="666" name="unnamed"/>
    <pic:cNvPicPr/>
  </pic:nvPicPr>
  <pic:blipFill>
    <a:blip/>
    <a:stretch>
      <a:fillRect/>
    </a:stretch>
  </pic:blipFill>
  <pic:spPr>
    <a:xfrm>
      <a:off x="0" y="0"/>
      <a:ext cx="914400" cy="914400"/>
    </a:xfrm>
    <a:prstGeom prst="rect"/>
  </pic:spPr>
</pic:pic>r/   rM   rN   r   rO   s    r   r[   zCT_Picture._pic_xml   s"    $ #5#s33%4	
r   N)rI   r<   rG   r1   rF   r1   r9   r   r:   r   r=   r.   )r   r   r   r   r   rV   r#   rW   rY   rP   rE   r[   r   r   r   r.   r.      s         55#0=$ $G     '4m' 'H      -}Z88D8888   [ 
 
 [
 
 
r   r.   c                  (    e Zd ZdZ ed          ZdS )rU   z9``<pic:nvPicPr>`` element, non-visual picture properties.z	pic:cNvPrN)r   r   r   r   r   r\   r   r   r   rU   rU      s#        CCM+&&EEEr   rU   c                  B    e Zd ZdZ ede          Z ede          ZdS )
CT_Point2DzaUsed for ``<a:off>`` element, and perhaps others.

    Specifies an x, y coordinate (point).
    xyN)r   r   r   r   r   r	   ra   rb   r   r   r   r`   r`      s>         
 	#}--A#}--AAAr   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 )r4   zpUsed for ``<wp:extent>`` element, and perhaps others later.

    Specifies the size of a DrawingML drawing.
    r9   r   r:   N)	r   r   r   r   r   r   r9   r#   r:   r   r   r   r4   r4      s|          
 #"# B     #"# B      r   r4   c                      e Zd ZdZdS )CT_PresetGeometry2DzW``<a:prstGeom>`` element, specifies an preset autoshape geometry, such as
    ``rect``.Nr   r   r   r   re   re      s           r   re   c                      e Zd ZdZdS )CT_RelativeRectzX``<a:fillRect>`` element, specifying picture should fill containing rectangle
    shape.Nr   r   r   r   rg   rg                 r   rg   c                      e Zd ZdZ edd          Zed             Zej        d             Zed             Z	e	j        d             Z	d	S )
rX   zF``<pic:spPr>`` element, specifies size and shape of picture container.za:xfrm)z
a:custGeomz
a:prstGeomza:lnza:effectLstza:effectDagz	a:scene3dza:sp3dza:extLstr&   c                &    | j         }|dS |j        S )z:Shape width as an instance of Emu, or None if not present.N)xfrmr9   selfrk   s     r   r9   zCT_ShapeProperties.cx        y<4wr   c                <    |                                  }||_        d S N)get_or_add_xfrmr9   rm   valuerk   s      r   r9   zCT_ShapeProperties.cx       ##%%r   c                &    | j         }|dS |j        S )z;Shape height as an instance of Emu, or None if not present.N)rk   r:   rl   s     r   r:   zCT_ShapeProperties.cy   rn   r   c                <    |                                  }||_        d S rp   )rq   r:   rr   s      r   r:   zCT_ShapeProperties.cy  rt   r   N)
r   r   r   r   r   rk   propertyr9   setterr:   r   r   r   rX   rX      s        PP9	
  D   X Y  Y   X Y  Y  r   rX   c                      e Zd ZdZdS )CT_StretchInfoPropertieszT``<a:stretch>`` element, specifies how picture should fill its containing
    shape.Nr   r   r   r   rz   rz   
  rh   r   rz   c                      e Zd ZdZ edd          Z edd          Zed             Zej	        d             Zed	             Z
e
j	        d
             Z
dS )CT_Transform2DzD``<a:xfrm>`` element, specifies size and shape of picture container.za:off)a:extr&   r}   r   c                &    | j         }|d S |j        S rp   )extr9   rm   r   s     r   r9   zCT_Transform2D.cx      h;4vr   c                <    |                                  }||_        d S rp   )get_or_add_extr9   rm   rs   r   s      r   r9   zCT_Transform2D.cx      !!##r   c                &    | j         }|d S |j        S rp   )r   r:   r   s     r   r:   zCT_Transform2D.cy!  r   r   c                <    |                                  }||_        d S rp   )r   r:   r   s      r   r:   zCT_Transform2D.cy(  r   r   N)r   r   r   r   r   offr   rw   r9   rx   r:   r   r   r   r|   r|     s        NN
)G

3
3
3C
)G
+
+
+C  X Y  Y   X Y  Y  r   r|   N)*r   
__future__r   typingr   r   docx.oxml.nsr   docx.oxml.parserr   docx.oxml.simpletypesr	   r
   r   r   r   r   docx.oxml.xmlchemyr   r   r   r   r   docx.sharedr   r   r    r%   r*   r+   r3   r6   rS   r.   rU   r`   r4   re   rg   rX   rz   r|   r   r   r   <module>r      s   J J " " " " " " & & & & & & & &             & & & & & &                              #""""""C C C C C C C C	 	 	 	 	o 	 	 	    O          2 2 2 2 2_ 2 2 22
 2
 2
 2
 2
 2
 2
 2
j0 0 0 0 0 0 0 0V V V V VO V V V,
 ,
 ,
 ,
 ,
 ,
 ,
 ,
^' ' ' ' '/ ' ' '. . . . . . . .           /   
    o   
) ) ) ) ) ) ) )X       
    _     r   