
    jb
                     d    d Z ddlmZ ddlmZ ddlmZ  G d de          Z G d d          Zd	S )
zhObjects related to shapes.

A shape is a visual object that appears on the drawing layer of a document.
    )WD_INLINE_SHAPE)nsmap)Parentedc                   J     e Zd ZdZ fdZd Zd Zd Zed             Z	 xZ
S )InlineShapeszYSequence of |InlineShape| instances, supporting len(), iteration, and indexed
    access.c                 f    t          t          |                               |           || _        d S N)superr   __init___body)selfbody_elmparent	__class__s      T/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/docx/shape.pyr   zInlineShapes.__init__   s,    lD!!**6222


    c                     	 | j         |         }n"# t          $ r d|z  }t          |          w xY wt          |          S )z2Provide indexed access, e.g. 'inline_shapes[idx]'.z$inline shape index [%d] out of range)_inline_lst
IndexErrorInlineShape)r   idxinlinemsgs       r   __getitem__zInlineShapes.__getitem__   sW    	"%c*FF 	" 	" 	"83>CS//!	" 6"""s    /c                 $    d | j         D             S )Nc              3   4   K   | ]}t          |          V  d S r	   )r   ).0r   s     r   	<genexpr>z(InlineShapes.__iter__.<locals>.<genexpr>   s*      CCF##CCCCCCr   )r   r   s    r   __iter__zInlineShapes.__iter__   s    CC$2BCCCCr   c                 *    t          | j                  S r	   )lenr   r   s    r   __len__zInlineShapes.__len__   s    4#$$$r   c                 >    | j         }d}|                    |          S )Nz//w:p/w:r/w:drawing/wp:inline)r   xpath)r   bodyr%   s      r   r   zInlineShapes._inline_lst"   s     z/zz%   r   )__name__
__module____qualname____doc__r   r   r    r#   propertyr   __classcell__r   s   @r   r   r      s             # # #D D D% % % ! ! X! ! ! ! !r   r   c                        e Zd ZdZ fdZed             Zej        d             Zed             Zed             Z	e	j        d             Z	 xZ
S )r   zdProxy for an ``<wp:inline>`` element, representing the container for an inline
    graphical object.c                 d    t          t          |                                            || _        d S r	   )r
   r   r   _inline)r   r   r   s     r   r   zInlineShape.__init__-   s*    k4  ))+++r   c                 $    | j         j        j        S )z[Read/write.

        The display height of this inline shape as an |Emu| instance.
        )r0   extentcyr   s    r   heightzInlineShape.height1        |"%%r   c                 h    || j         j        _        || j         j        j        j        j        _        d S r	   )r0   r2   r3   graphicgraphicDatapicspPr)r   r3   s     r   r4   zInlineShape.height9   +    !#79(,1444r   c                 @   | j         j        j        }|j        }|t          d         k    r0|j        j        j        }|j        t          j
        S t          j        S |t          d         k    rt          j        S |t          d         k    rt          j        S t          j        S )zThe type of this inline shape as a member of
        ``docx.enum.shape.WD_INLINE_SHAPE``, e.g. ``LINKED_PICTURE``.

        Read-only.
        r9   Ncdgm)r0   r7   r8   urir   r9   blipFillbliplinkr   LINKED_PICTUREPICTURECHART	SMART_ARTNOT_IMPLEMENTED)r   r8   r?   rA   s       r   typezInlineShape.type>   s     l*6o%,?+0Dy$&55"**%*"((%,",,..r   c                 $    | j         j        j        S )zZRead/write.

        The display width of this inline shape as an |Emu| instance.
        )r0   r2   cxr   s    r   widthzInlineShape.widthR   r5   r   c                 h    || j         j        _        || j         j        j        j        j        _        d S r	   )r0   r2   rJ   r7   r8   r9   r:   )r   rJ   s     r   rK   zInlineShape.widthZ   r;   r   )r'   r(   r)   r*   r   r+   r4   setterrH   rK   r,   r-   s   @r   r   r   )   s              & & X& ]: : ]: / / X/& & & X& \: : \: : : : :r   r   N)	r*   docx.enum.shaper   docx.oxml.nsr   docx.sharedr   r   r    r   r   <module>rR      s    
 , + + + + +                  ! ! ! ! !8 ! ! !<4: 4: 4: 4: 4: 4: 4: 4: 4: 4:r   