Ë
    \RðiÅ  ã                  óê   — U 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 ddlmZ ddlmZ er0dd	lm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 ddlmZ ddlmZ dZde d<    G d„ de«      Z!y	)z¾Block item container, used by body, cell, header, etc.

Block level items are things like paragraph and table, although there are a few other
specialized ones like structured document tags.
é    )Úannotations)ÚTYPE_CHECKINGÚIterator)Ú	TypeAlias)ÚCT_Tbl)ÚCT_P)Ú
StoryChild)Ú	ParagraphN)Ú
CT_Comment)ÚCT_Body)Ú	CT_HdrFtr)ÚCT_Tc)ÚLength)ÚParagraphStyle©ÚTablez(CT_Body | CT_Comment | CT_HdrFtr | CT_Tcr   ÚBlockItemElementc                  ód   ‡ — e Zd ZdZd	ˆ fd„Zd
dd„Zdd„Zdd„Zed„ «       Z	ed„ «       Z
d„ Zˆ xZS )ÚBlockItemContainera  Base class for proxy objects that can contain block items.

    These containers include _Body, _Cell, header, footer, footnote, endnote, comment,
    and text box objects. Provides the shared functionality to add a block item like a
    paragraph or table.
    c                ó:   •— t         t        | �  |«       || _        y )N)Úsuperr   Ú__init__Ú_element)ÚselfÚelementÚparentÚ	__class__s      €úH/var/www/html/Extract/venv/lib/python3.12/site-packages/docx/blkcntnr.pyr   zBlockItemContainer.__init__)   s   ø€ ÜÔ  $Ñ0°Ô8Øˆ�ó    c                ó^   — | j                  «       }|r|j                  |«       |�||_        |S )a>  Return paragraph newly added to the end of the content in this container.

        The paragraph has `text` in a single run if present, and is given paragraph
        style `style`.

        If `style` is |None|, no paragraph style is applied, which has the same effect
        as applying the 'Normal' style.
        )Ú_add_paragraphÚadd_runÚstyle)r   Útextr#   Ú	paragraphs       r   Úadd_paragraphz BlockItemContainer.add_paragraph-   s6   € ð ×'Ñ'Ó)ˆ	ÙØ×Ñ˜dÔ#ØÐØ#ˆIŒOØÐr   c                ó„   — ddl m} t        j                  |||«      }| j                  j                  |«        ||| «      S )zÞReturn table of `width` having `rows` rows and `cols` columns.

        The table is appended appended at the end of the content in this container.

        `width` is evenly distributed between the table columns.
        r   r   )Ú
docx.tabler   r   Únew_tblr   Ú_insert_tbl)r   ÚrowsÚcolsÚwidthr   Útbls         r   Ú	add_tablezBlockItemContainer.add_table=   s8   € õ 	%ä�n‰n˜T 4¨Ó/ˆØ�‰×!Ñ! #Ô&Ù�S˜$ÓÐr   c              #  óœ   K  — ddl m} | j                  j                  D ])  }t	        |t
        «      rt        || «      n ||| «      –— Œ+ y­w)zIGenerate each `Paragraph` or `Table` in this container in document order.r   r   N)r(   r   r   Úinner_content_elementsÚ
isinstancer   r
   )r   r   r   s      r   Úiter_inner_contentz%BlockItemContainer.iter_inner_contentJ   sE   è ø€ å$à—}‘}×;Ñ;ò 	dˆGÜ/9¸'Ä4Ô/H”9˜W dÔ+ÉeÐT[Ð]aÓNbÓcñ	dùs   ‚A
Ac                óh   — | j                   j                  D �cg c]  }t        || «      ‘Œ c}S c c}w )zcA list containing the paragraphs in this container, in document order.

        Read-only.
        )r   Úp_lstr
   )r   Úps     r   Ú
paragraphszBlockItemContainer.paragraphsQ   s)   € ð -1¯M©M×,?Ñ,?Ö@ q”	˜!˜TÕ"Ò@Ð@ùÒ@s   ™/c                ón   — ddl m} | j                  j                  D �cg c]  } ||| «      ‘Œ c}S c c}w )z_A list containing the tables in this container, in document order.

        Read-only.
        r   r   )r(   r   r   Útbl_lst)r   r   r.   s      r   ÚtableszBlockItemContainer.tablesY   s,   € õ 	%à,0¯M©M×,AÑ,AÖB S‘�c˜4Õ ÒBÐBùÒBs   Ÿ2c                óJ   — t        | j                  j                  «       | «      S )zIReturn paragraph newly added to the end of the content in this container.)r
   r   Úadd_p)r   s    r   r!   z!BlockItemContainer._add_paragraphc   s   € ä˜Ÿ™×,Ñ,Ó.°Ó5Ð5r   )r   r   r   zt.ProvidesStoryPart)Ú N)r$   Ústrr#   zstr | ParagraphStyle | NoneÚreturnr
   )r+   Úintr,   r@   r-   r   r?   r   )r?   zIterator[Paragraph | Table])Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   r/   r3   Úpropertyr7   r:   r!   Ú__classcell__)r   s   @r   r   r   !   sN   ø„ ñõ ôó  ódð ñAó ðAð ñCó ðCö6r   r   )"rD   Ú
__future__r   Útypingr   r   Útyping_extensionsr   Údocx.oxml.tabler   Údocx.oxml.text.paragraphr   Údocx.sharedr	   Údocx.text.paragraphr
   Ú
docx.typesÚtypesÚtÚdocx.oxml.commentsr   Údocx.oxml.documentr   Údocx.oxml.sectionr   r   r   Údocx.styles.styler   r(   r   r   Ú__annotations__r   © r   r   ú<module>rW      sU   ðòõ #ç *å 'å "Ý )Ý "Ý )áÝÝ-Ý*Ý+Ý%Ý"Ý0Ý àHÐ �)Ó HôD6˜õ D6r   