o
    Z2h4#                     @  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   `/home/skpark/git/infrasmart_work/infrasmart/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  s8   d}t |||||}| ||||}|jj| |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>   r2   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   j   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   z       
r0   c                   @  r   )CT_NonVisualPicturePropertieszK``<pic:cNvPicPr>`` element, specifies picture locking and resize behaviors.Nr   r   r   r   r   rI      r   rI   c                   @  sZ   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dS )r)   z+``<pic:pic>`` element, a DrawingML picture.zpic:nvPicPrCT_PictureNonVisualnvPicPrzpic:blipFillr"   blipFillzpic:spPrCT_ShapePropertiesspPrc                 C  s>   t |  }||jj_||jj_||jj_||j	_
||j	_|S )zReturn a new ``<pic:pic>`` element populated with the minimal contents
        required to define a viable picture element, based on the values passed as
        parameters.)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)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     6
1
,