
    j                    b   d Z ddl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 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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__     Y/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/docx/oxml/shape.pyr   r      s        BBBBr   r   c                  B    e Zd ZdZ ede          Z ede          ZdS )CT_BlipzX``<a:blip>`` element, specifies image source and adjustments such as alpha and
    tint.zr:embedzr:linkN)r   r   r   r   r   r   embedlinkr   r   r   r   r   !   s@          i):;;EX'899DDDr   r   c                  ,    e Zd ZdZ edd          ZdS )CT_BlipFillPropertiesz9``<pic:blipFill>`` element, specifies picture properties.za:blip)z	a:srcRectza:tilez	a:stretch
successorsN)r   r   r   r   r   blipr   r   r   r#   r#   )   s)        CC9X*NOOODDDr   r#   c                  (    e Zd ZdZ ed          ZdS )CT_GraphicalObjectz:``<a:graphic>`` element, container for a DrawingML object.za:graphicDataN)r   r   r   r   r   graphicDatar   r   r   r(   r(   /   s#        DD-00KKKr   r(   c                  @    e Zd ZdZ ed          Z ede          ZdS )CT_GraphicalObjectDatazI``<a:graphicData>`` element, container for the XML of a DrawingML object.zpic:picuriN)	r   r   r   r   r   picr   r   r,   r   r   r   r+   r+   5   s5        SS
)I

C

E8
,
,CCCr   r+   c                      e Zd ZdZ ed          Z ed          Z ed          Z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:extentzwp:docPrz	a:graphiccxr   cyshape_idintr-   
CT_Picturereturnc                   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   _inline_xmlextentr0   r1   docPridnamegraphicr)   r,   _insert_pic)clsr0   r1   r2   r-   inlines         r   newzCT_Inline.newC   sw     3??,,--"(83F 	"& 	"..s333r   rIdstrfilenamec                    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   )r4   r@   r<   r)   r=   )	r>   r2   rA   rC   r0   r1   pic_idr-   r?   s	            r   new_pic_inlinezCT_Inline.new_pic_inlineR   sW     nnVXsB;;R3//"..s33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   r>   s    r   r7   zCT_Inline._inline_xml`   s$    	 %T3s;;	<	
r   N)
r0   r   r1   r   r2   r3   r-   r4   r5   r/   )r2   r3   rA   rB   rC   rB   r0   r   r1   r   r5   r/   )r   r   r   r   r   r8   r9   r<   classmethodr@   rF   r7   r   r   r   r/   r/   <   s        ??];''FM*%%EmK((G   [    [ 
 
 [
 
 
r   r/   c                  B    e Zd ZdZ ede          Z ede          ZdS )CT_NonVisualDrawingPropszpUsed for ``<wp:docPr>`` element, and perhaps others.

    Specifies the id and name of a DrawingML drawing.
    r:   r;   N)	r   r   r   r   r   r	   r:   r   r;   r   r   r   rN   rN   p   s?         
 
	4!4	5	5BVY//DDDr   rN   c                      e Zd ZdZdS )CT_NonVisualPicturePropertieszK``<pic:cNvPicPr>`` element, specifies picture locking and resize behaviors.Nr   r   r   r   rP   rP   z   s        UUUUr   rP   c                      e Zd ZdZ ed          Z ed          Z ed          Zed             Z	ed             Z
dS )r4   z+``<pic:pic>`` element, a DrawingML picture.zpic:nvPicPrzpic:blipFillzpic:spPrc                    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_xmlnvPicPrcNvPrr:   r;   blipFillr&   r    spPrr0   r1   )r>   rE   rC   rA   r0   r1   r-   s          r   r@   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-   rI   rJ   r   rK   s    r   rS   zCT_Picture._pic_xml   s"    $ #5#s33%4	
r   N)r   r   r   r   r   rT   rV   rW   rL   r@   rS   r   r   r   r4   r4   ~   s{        55mM**G}^,,H=$$D
 
 [
 
 
 [
 
 
r   r4   c                  (    e Zd ZdZ ed          ZdS )CT_PictureNonVisualz9``<pic:nvPicPr>`` element, non-visual picture properties.z	pic:cNvPrN)r   r   r   r   r   rU   r   r   r   rZ   rZ      s#        CCM+&&EEEr   rZ   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   r]   r^   r   r   r   r\   r\      s>         
 	#}--A#}--AAAr   r\   c                  B    e Zd ZdZ ede          Z ede          ZdS )CT_PositiveSize2DzpUsed for ``<wp:extent>`` element, and perhaps others later.

    Specifies the size of a DrawingML drawing.
    r0   r1   N)r   r   r   r   r   r
   r0   r1   r   r   r   r`   r`      s@         
 
	4!6	7	7B		4!6	7	7BBBr   r`   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   rb   rb      s           r   rb   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   rd   rd                 r   rd   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 )
CT_ShapePropertieszF``<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)xfrmr0   selfri   s     r   r0   zCT_ShapeProperties.cx        y<4wr   c                <    |                                  }||_        d S N)get_or_add_xfrmr0   rk   valueri   s      r   r0   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)ri   r1   rj   s     r   r1   zCT_ShapeProperties.cy   rl   r   c                <    |                                  }||_        d S rn   )ro   r1   rp   s      r   r1   zCT_ShapeProperties.cy   rr   r   N)
r   r   r   r   r   ri   propertyr0   setterr1   r   r   r   rg   rg      s        PP9	
  D   X Y  Y   X Y  Y  r   rg   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   rx   rx      re   r   rx   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 rn   )extr0   rk   r}   s     r   r0   zCT_Transform2D.cx      h;4vr   c                <    |                                  }||_        d S rn   )get_or_add_extr0   rk   rq   r}   s      r   r0   zCT_Transform2D.cx      !!##r   c                &    | j         }|d S |j        S rn   )r}   r1   r~   s     r   r1   zCT_Transform2D.cy  r   r   c                <    |                                  }||_        d S rn   )r   r1   r   s      r   r1   zCT_Transform2D.cy  r   r   N)r   r   r   r   r   offr}   ru   r0   rv   r1   r   r   r   rz   rz      s        NN
)G

3
3
3C
)G
+
+
+C  X Y  Y   X Y  Y  r   rz   N))r   
__future__r   typingr   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/   rN   rP   r4   rZ   r\   r`   rb   rd   rg   rx   rz   r   r   r   <module>r      s   J J " " " " " "                         & & & & & &                              #""""""C C C C C C C C: : : : :o : : :P P P P PO P P P1 1 1 1 1 1 1 1- - - - -_ - - -1
 1
 1
 1
 1
 1
 1
 1
h0 0 0 0 0 0 0 0V V V V VO V V V*
 *
 *
 *
 *
 *
 *
 *
Z' ' ' ' '/ ' ' '. . . . . . . .8 8 8 8 8 8 8 8    /   
    o   
) ) ) ) ) ) ) )X       
    _     r   