a
    ]j"                     @  s  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rddlmZ G d	d
 d
eZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZ G dd deZ!G dd deZ"G dd deZ#G dd  d eZ$G d!d" d"eZ%G d#d$ d$eZ&G d%d& d&eZ'G d'd( d(eZ(G d)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                   @  s   e Zd ZdZdS )	CT_Anchorz8`<wp:anchor>` element, container for a "floating" shape.N__name__
__module____qualname____doc__ r   r   K/var/www/html/assistant/venv/lib/python3.9/site-packages/docx/oxml/shape.pyr      s   r   c                   @  s6   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   
r   c                   @  s&   e Zd ZU dZed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    -   s   
r    c                   @  s"   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   s   
r$   c                   @  s4   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   r)   r   r   r   r   r%   =   s   
r%   c                   @  s   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ddd dddZ
e	dddddd dddZe	d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$   graphicr   intr'   )cxcyshape_idr(   returnc                 C  sR   t tt|  }||j_||j_||j_d| |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   r+   r   _inline_xmlr-   r2   r3   r/   idnamer0   r&   r)   Z_insert_pic)clsr2   r3   r4   r(   inliner   r   r   newO   s    
zCT_Inline.newr*   )r4   rIdfilenamer2   r3   r5   c           	      C  s*   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'   r;   )	r9   r4   r<   r=   r2   r3   pic_idr(   r:   r   r   r   new_pic_inline\   s    zCT_Inline.new_pic_inlinec                 C  s   dt dddd 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>Zwpar(   rr   r9   r   r   r   r6   i   s    	zCT_Inline._inline_xmlN)r   r   r   r   r   r-   r   r/   r0   classmethodr;   r?   r6   r   r   r   r   r+   D   s   
r+   c                   @  s$   e Zd ZdZedeZedeZdS )r.   zpUsed for ``<wp:docPr>`` element, and perhaps others.

    Specifies the id and name of a DrawingML drawing.
    r7   r8   N)	r   r   r   r   r   r	   r7   r   r8   r   r   r   r   r.   y   s   
r.   c                   @  s   e Zd ZdZdS )CT_NonVisualPicturePropertieszK``<pic:cNvPicPr>`` element, specifies picture locking and resize behaviors.Nr   r   r   r   r   rD      s   rD   c                   @  sj   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dddd dddZ
e	d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spPrr1   r*   r   )r>   r=   r<   r2   r3   r5   c                 C  s>   t |  }||jj_||jj_||jj_||j	_
||j	_|S )z3A new minimum viable `<pic:pic>` (picture) element.)r   _pic_xmlrF   cNvPrr7   r8   rG   r#   r   rI   r2   r3   )r9   r>   r=   r<   r2   r3   r(   r   r   r   r;      s    


zCT_Picture.newc                 C  s   dt ddd 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(   r@   rA   r   rB   r   r   r   rJ      s    
zCT_Picture._pic_xmlN)r   r   r   r   r   rF   r   rG   rI   rC   r;   rJ   r   r   r   r   r'      s   

r'   c                   @  s   e Zd ZdZedZdS )rE   z9``<pic:nvPicPr>`` element, non-visual picture properties.z	pic:cNvPrN)r   r   r   r   r   rK   r   r   r   r   rE      s   rE   c                   @  s$   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   rM   rN   r   r   r   r   rL      s   
rL   c                   @  s6   e Zd ZU dZedeZded< edeZded< dS )r,   zpUsed for ``<wp:extent>`` element, and perhaps others later.

    Specifies the size of a DrawingML drawing.
    r2   r   r3   N)	r   r   r   r   r   r
   r2   r   r3   r   r   r   r   r,      s   
r,   c                   @  s   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   r   rO      s   rO   c                   @  s   e Zd ZdZdS )CT_RelativeRectzX``<a:fillRect>`` element, specifying picture should fill containing rectangle
    shape.Nr   r   r   r   r   rP      s   rP   c                   @  sP   e Zd ZdZedddZedd Zejdd Zedd	 Z	e	jd
d	 Z	dS )rH   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                 C  s   | j }|du rdS |jS )z:Shape width as an instance of Emu, or None if not present.N)xfrmr2   selfrQ   r   r   r   r2      s    zCT_ShapeProperties.cxc                 C  s   |   }||_d S N)get_or_add_xfrmr2   rS   valuerQ   r   r   r   r2      s    c                 C  s   | j }|du rdS |jS )z;Shape height as an instance of Emu, or None if not present.N)rQ   r3   rR   r   r   r   r3      s    zCT_ShapeProperties.cyc                 C  s   |   }||_d S rT   )rU   r3   rV   r   r   r   r3     s    N)
r   r   r   r   r   rQ   propertyr2   setterr3   r   r   r   r   rH      s   


rH   c                   @  s   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   r   rZ   
  s   rZ   c                   @  s\   e Zd ZdZedddZedddZedd Zej	d	d Zed
d Z
e
j	dd Z
dS )CT_Transform2DzD``<a:xfrm>`` element, specifies size and shape of picture container.za:off)a:extr!   r\   r   c                 C  s   | j }|d u rd S |jS rT   )extr2   rS   r]   r   r   r   r2     s    zCT_Transform2D.cxc                 C  s   |   }||_d S rT   )get_or_add_extr2   rS   rW   r]   r   r   r   r2     s    c                 C  s   | j }|d u rd S |jS rT   )r]   r3   r^   r   r   r   r3   !  s    zCT_Transform2D.cyc                 C  s   |   }||_d S rT   )r_   r3   r`   r   r   r   r3   (  s    N)r   r   r   r   r   offr]   rX   r2   rY   r3   r   r   r   r   r[     s   


r[   N)*r   
__future__r   typingr   r   Zdocx.oxml.nsr   Zdocx.oxml.parserr   Zdocx.oxml.simpletypesr   r	   r
   r   r   r   Zdocx.oxml.xmlchemyr   r   r   r   r   Zdocx.sharedr   r   r   r    r$   r%   r+   r.   rD   r'   rE   rL   r,   rO   rP   rH   rZ   r[   r   r   r   r   <module>   s2    5
/
,