o
    ýÞh³"  ã                   @  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rBd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                   @  ó   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   úO/var/www/html/premium_crap/venv/lib/python3.10/site-packages/docx/oxml/shape.pyr      ó    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                   @  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„ƒZ
e	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&   ÚgraphicÚcxr   ÚcyÚshape_idÚintr*   r)   Ú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/   r3   r4   r1   ÚidÚnamer2   r(   r+   Ú_insert_pic)Úclsr3   r4   r5   r*   Úinliner   r   r   ÚnewO   s   
zCT_Inline.newÚrIdr,   Úfilenamec           	      C  s*   d}t  |||||¡}|  ||||¡}|S )z•Create `wp:inline` element containing a `pic:pic` element.

        The contents of the `pic:pic` element is taken from the argument values.
        r   )r)   r>   )	r<   r5   r?   r@   r3   r4   Ú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>ÚwpÚar*   Úrr   ©r<   r   r   r   r8   i   s   	÷ÿzCT_Inline._inline_xmlN)
r3   r   r4   r   r5   r6   r*   r)   r7   r-   )r5   r6   r?   r,   r@   r,   r3   r   r4   r   r7   r-   )r   r   r   r   r   r/   r!   r1   r2   Úclassmethodr>   rB   r8   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 )r0   zpUsed for ``<wp:docPr>`` element, and perhaps others.

    Specifies the id and name of a DrawingML drawing.
    r9   r:   N)	r   r   r   r   r   r	   r9   r   r:   r   r   r   r   r0   y   ó    
r0   c                   @  r   )ÚCT_NonVisualPicturePropertieszK``<pic:cNvPicPr>`` element, specifies picture locking and resize behaviors.Nr   r   r   r   r   rI   ƒ   r   rI   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„ƒ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ÚspPrrA   r6   r@   r,   r?   r3   r   r4   r7   c                 C  s>   t |  ¡ ƒ}||jj_||jj_||jj_||j	_
||j	_|S )z3A new minimum viable `<pic:pic>` (picture) element.)r   Ú_pic_xmlrK   ÚcNvPrr9   r:   rL   r%   r   rN   r3   r4   )r<   rA   r@   r?   r3   r4   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*   rD   rE   r   rF   r   r   r   rO   �   s   
îÿzCT_Picture._pic_xmlN)rA   r6   r@   r,   r?   r,   r3   r   r4   r   r7   r)   )r   r   r   r   r   rK   r!   rL   rN   rG   r>   rO   r   r   r   r   r)   ‡   s   
 ÿÿ
r)   c                   @  s   e Zd ZdZedƒZdS )rJ   z9``<pic:nvPicPr>`` element, non-visual picture properties.z	pic:cNvPrN)r   r   r   r   r   rP   r   r   r   r   rJ   ¶   s    rJ   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   rR   rS   r   r   r   r   rQ   ¼   rH   rQ   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.
    r3   r   r4   N)	r   r   r   r   r   r
   r3   r!   r4   r   r   r   r   r.   Æ   s   
 ÿÿr.   c                   @  r   )ÚCT_PresetGeometry2DzW``<a:prstGeom>`` element, specifies an preset autoshape geometry, such as
    ``rect``.Nr   r   r   r   r   rT   Ô   r   rT   c                   @  r   )ÚCT_RelativeRectzX``<a:fillRect>`` element, specifying picture should fill containing rectangle
    shape.Nr   r   r   r   r   rU   Ù   r   rU   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 )rM   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  ó   | j }|du r	dS |jS )z:Shape width as an instance of Emu, or None if not present.N)Úxfrmr3   ©ÚselfrW   r   r   r   r3   ï   ó   zCT_ShapeProperties.cxc                 C  ó   |   ¡ }||_d S ©N)Úget_or_add_xfrmr3   ©rY   ÚvaluerW   r   r   r   r3   ÷   ó   
c                 C  rV   )z;Shape height as an instance of Emu, or None if not present.N)rW   r4   rX   r   r   r   r4   ü   rZ   zCT_ShapeProperties.cyc                 C  r[   r\   )r]   r4   r^   r   r   r   r4     r`   N)
r   r   r   r   r   rW   Úpropertyr3   Úsetterr4   r   r   r   r   rM   Þ   s    þ


rM   c                   @  r   )ÚCT_StretchInfoPropertieszT``<a:stretch>`` element, specifies how picture should fill its containing
    shape.Nr   r   r   r   r   rc   
  r   rc   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#   re   r   c                 C  ó   | j }|d u r	d S |jS r\   )Úextr3   ©rY   rg   r   r   r   r3     ó   zCT_Transform2D.cxc                 C  r[   r\   )Úget_or_add_extr3   ©rY   r_   rg   r   r   r   r3     r`   c                 C  rf   r\   )rg   r4   rh   r   r   r   r4   !  ri   zCT_Transform2D.cyc                 C  r[   r\   )rj   r4   rk   r   r   r   r4   (  r`   N)r   r   r   r   r   Úoffrg   ra   r3   rb   r4   r   r   r   r   rd     s    


rd   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'   r-   r0   rI   r)   rJ   rQ   r.   rT   rU   rM   rc   rd   r   r   r   r   Ú<module>   s4     5
/
,