
    Pqh                       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(y+),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y)	CT_Anchorz8`<wp:anchor>` element, container for a "floating" shape.N__name__
__module____qualname____doc__     P/srv/www/ollama/chat-ollama/venv/lib/python3.12/site-packages/docx/oxml/shape.pyr   r      s    Br   r   c                  4    e Zd ZdZ ede      Z ede      Zy)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9Dr   r   c                  $    e Zd ZdZ edd      Zy)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X*NODr   r#   c                       e Zd ZdZ ed      Zy)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0Kr   r(   c                  2    e Zd ZdZ ed      Z ede      Zy)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   s    S
I
C
E8
,Cr   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y)	CT_Inlinez5`<wp:inline>` element, container for an inline shape.z	wp:extentzwp:docPrz	a:graphicc                F   t        | j                               }||j                  _        ||j                  _        ||j
                  _        d|z  |j
                  _        d|j                  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extentcxcydocPridnamegraphicr)   r,   _insert_pic)clsr3   r4   shape_idr-   inlines         r   newzCT_Inline.newC   s}     3??,-"(83F 	""& 	""..s3r   c                    d}t         j                  |||||      }| j                  ||||      }|j                  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   )
CT_Picturer=   r8   r)   r9   )	r:   r;   rIdfilenamer3   r4   pic_idr-   r<   s	            r   new_pic_inlinezCT_Inline.new_pic_inlineR   sP     nnVXsB;R3/""..s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   r1   zCT_Inline._inline_xml`   s!    	 %T3s;	<	
r   N)
r3   r   r4   r   r;   intr-   r?   returnr/   )r;   rI   r@   strrA   rK   r3   r   r4   r   rJ   r/   )r   r   r   r   r   r2   r5   r8   classmethodr=   rC   r1   r   r   r   r/   r/   <   s    ?;'F*%EK(G  !$039?EK	  
 
r   r/   c                  4    e Zd ZdZ ede      Z ede      Zy)CT_NonVisualDrawingPropszpUsed for ``<wp:docPr>`` element, and perhaps others.

    Specifies the id and name of a DrawingML drawing.
    r6   r7   N)	r   r   r   r   r   r	   r6   r   r7   r   r   r   rN   rN   p   s"    
 
4!4	5BVY/Dr   rN   c                      e Zd ZdZy)CT_NonVisualPicturePropertieszK``<pic:cNvPicPr>`` element, specifies picture locking and resize behaviors.Nr   r   r   r   rP   rP   z   s    Ur   rP   c                  `    e Zd ZdZ ed      Z ed      Z ed      Zed        Z	ed        Z
y)r?   z+``<pic:pic>`` element, a DrawingML picture.zpic:nvPicPrzpic:blipFillzpic:spPrc                   t        | j                               }||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cNvPrr6   r7   blipFillr&   r    spPrr3   r4   )r:   rB   rA   r@   r3   r4   r-   s          r   r=   zCT_Picture.new   se    
 '%!)"%
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-   rF   rG   r   rH   s    r   rS   zCT_Picture._pic_xml   s    $ #5#s3%4	
r   N)r   r   r   r   r   rT   rV   rW   rL   r=   rS   r   r   r   r?   r?   ~   sI    5M*G^,H$D
 
 
 
r   r?   c                       e Zd ZdZ ed      Zy)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+&Er   rZ   c                  4    e Zd ZdZ ede      Z ede      Zy)
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#}-Ar   r\   c                  4    e Zd ZdZ ede      Z ede      Zy)CT_PositiveSize2DzpUsed for ``<wp:extent>`` element, and perhaps others later.

    Specifies the size of a DrawingML drawing.
    r3   r4   N)r   r   r   r   r   r
   r3   r4   r   r   r   r`   r`      s#    
 
4!6	7B	4!6	7Br   r`   c                      e Zd ZdZy)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y)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	y	)
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                8    | j                   }|y|j                  S )z:Shape width as an instance of Emu, or None if not present.N)xfrmr3   selfri   s     r   r3   zCT_ShapeProperties.cx        yy<wwr   c                2    | j                         }||_        y N)get_or_add_xfrmr3   rk   valueri   s      r   r3   zCT_ShapeProperties.cx       ##%r   c                8    | j                   }|y|j                  S )z;Shape height as an instance of Emu, or None if not present.N)ri   r4   rj   s     r   r4   zCT_ShapeProperties.cy   rl   r   c                2    | j                         }||_        y rn   )ro   r4   rp   s      r   r4   zCT_ShapeProperties.cy   rr   r   N)
r   r   r   r   r   ri   propertyr3   setterr4   r   r   r   rg   rg      so    P	
D   YY    YY r   rg   c                      e Zd ZdZy)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
y)CT_Transform2DzD``<a:xfrm>`` element, specifies size and shape of picture container.za:off)a:extr$   r{   r   c                8    | j                   }|y |j                  S rn   )extr3   rk   r}   s     r   r3   zCT_Transform2D.cx      hh;vvr   c                2    | j                         }||_        y rn   )get_or_add_extr3   rk   rq   r}   s      r   r3   zCT_Transform2D.cx      !!#r   c                8    | j                   }|y |j                  S rn   )r}   r4   r~   s     r   r4   zCT_Transform2D.cy  r   r   c                2    | j                         }||_        y rn   )r   r4   r   s      r   r4   zCT_Transform2D.cy  r   r   N)r   r   r   r   r   offr}   ru   r3   rv   r4   r   r   r   rz   rz      ss    N
G

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