Xj UdZddlmZddlmZmZddlmZddlm Z ddl m Z ddl m Z ddlmZer0dd lmZdd lmZdd lmZdd lmZdd lmZddl mZddlmZddlmZdZde d<Gdde 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_CHECKINGIterator) TypeAlias)CT_Tbl)CT_P) StoryChild) ParagraphN) CT_Comment)CT_Body) CT_HdrFtr)CT_Tc)Length)ParagraphStyleTablez(CT_Body | CT_Comment | CT_HdrFtr | CT_TcrBlockItemElementcdeZdZdZd fd Zd d dZd dZd dZedZ edZ dZ xZ S)BlockItemContaineraBase 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:tt| |||_y)N)superr__init___element)selfelementparent __class__s a/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/docx/blkcntnr.pyrzBlockItemContainer.__init__)s  $08 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_paragraphadd_runstyle)rtextr# paragraphs r add_paragraphz BlockItemContainer.add_paragraph-s6'')    d #  #IOrcddlm}tj|||}|jj ||||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. rr) docx.tablerrnew_tblr _insert_tbl)rrowscolswidthrtbls r add_tablezBlockItemContainer.add_table=s8 %nnT4/ !!#&S$rc#Kddlm}|jjD])}t |t r t ||n|||+yw)zIGenerate each `Paragraph` or `Table` in this container in document order.rrN)r(rrinner_content_elements isinstancerr )rrrs riter_inner_contentz%BlockItemContainer.iter_inner_contentJsE$}};; dG/9'4/H9Wd+eT[]aNb c dsA A ch|jjDcgc]}t||c}Scc}w)zcA list containing the paragraphs in this container, in document order. Read-only. )rp_lstr )rps r paragraphszBlockItemContainer.paragraphsQs) -1MM,?,?@q !T"@@@s/cnddlm}|jjDcgc] }||| c}Scc}w)z_A list containing the tables in this container, in document order. Read-only. rr)r(rrtbl_lst)rrr.s rtableszBlockItemContainer.tablesYs, %,0MM,A,ABSc4 BBBs2cJt|jj|S)zIReturn paragraph newly added to the end of the content in this container.)r radd_p)rs rr!z!BlockItemContainer._add_paragraphcs,,.55r)rrrzt.ProvidesStoryPart)N)r$strr#zstr | ParagraphStyle | Nonereturnr )r+intr,r@r-rr?r)r?zIterator[Paragraph | Table]) __name__ __module__ __qualname____doc__rr&r/r3propertyr7r:r! __classcell__)rs@rrr!sN   dAACC6rr)"rD __future__rtypingrrtyping_extensionsrdocx.oxml.tablerdocx.oxml.text.paragraphr docx.sharedr docx.text.paragraphr docx.typestypestdocx.oxml.commentsr docx.oxml.documentr docx.oxml.sectionr rrdocx.styles.stylerr(rr__annotations__rrrrWsU #*'")")-*+%"0 H)HD6D6r