
    >h                        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	)zBlock 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      N/var/www/html/bid_assistant/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##IOr   c                    ddl m} t        j                  |||      }| j                  j                  |        |||       S )zReturn 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     	%nnT4/!!#&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/H9Wd+eT[]aNb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)     -1MM,?,?@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,     	%,0MM,A,ABSc4 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   