XjdZddlmZddlmZmZmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZerdd lmZdd lmZddlmZddlmZGdde Z y )zParagraph-related proxy types.) annotations) TYPE_CHECKINGIteratorListcast) WD_STYLE_TYPE)CT_R) StoryChild)ParagraphStyle) Hyperlink)RenderedPageBreak)ParagraphFormat)RunN)WD_PARAGRAPH_ALIGNMENT)CT_P)CharacterStylecXeZdZdZdfd ZdddZeddZejddZdZ eddZ eddZ d dd Z dd Z ed Zedd Zedd ZeddZejddZed dZejd!dZdZxZS)" Paragraphz(Proxy object wrapping a `` element.cHtt| ||x|_|_yN)superr__init___p_element)selfpparent __class__s g/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/docx/text/paragraph.pyrzParagraph.__init__s  i'/"##$-cv|jj}t||}|r||_|r||_|S)a{Append run containing `text` and having character-style `style`. `text` can contain tab (``\t``) characters, which are converted to the appropriate XML form for a tab. `text` can also include newline (``\n``) or carriage return (``\r``) characters, each of which is converted to a line break. When `text` is `None`, the new run is empty. )radd_rrtextstyle)rr#r$rruns radd_runzParagraph.add_runs7 GGMMO!Tl CH CI r c.|jjS)a{A member of the :ref:`WdParagraphAlignment` enumeration specifying the justification setting for this paragraph. A value of |None| indicates the paragraph has no directly-applied alignment value and will inherit its alignment value from its style hierarchy. Assigning |None| to this property removes any directly-applied alignment value. r alignmentrs rr*zParagraph.alignment.sww   r c&||j_yrr))rvalues rr*zParagraph.alignment9s!r c:|jj|S)zReturn this same paragraph after removing all its content. Paragraph-level formatting, such as style, is preserved. )r clear_contentr+s rclearzParagraph.clear=s  r c@t|jjS)zE`True` when one or more rendered page-breaks occur in this paragraph.)boolrlastRenderedPageBreaksr+s rcontains_page_breakzParagraph.contains_page_breakEsDGG2233r ch|jjDcgc]}t||c}Scc}w)z elements in this paragraph.)rr_lstr)rr%s rrunszParagraph.runs|s&'+ggmm4At 444r9c|jj}|jj|tj }t t|S)aRead/Write. |_ParagraphStyle| object representing the style assigned to this paragraph. If no explicit style is assigned to this paragraph, its value is the default paragraph style for the document. A paragraph style name can be assigned in lieu of a paragraph style object. Assigning |None| removes any applied style, making its effective value the default paragraph style for the document. )rr$part get_styler PARAGRAPHrr )rstyle_idr$s rr$zParagraph.styles:77== ##Hm.E.EFNE**r cz|jj|tj}||j_yr)rL get_style_idrrNrr$)r style_or_namerOs rr$zParagraph.styles)99))-9P9PQ  r c.|jjS)aThe textual content of this paragraph. The text includes the visible-text portion of any hyperlinks in the paragraph. Tabs and line breaks in the XML are mapped to ``\t`` and ``\n`` characters respectively. Assigning text to this property causes all existing paragraph content to be replaced with a single run containing the assigned text. A ``\t`` character in the text is mapped to a ```` element and each ``\n`` or ``\r`` character is mapped to a line break. Paragraph-level formatting, such as style, is preserved. All run-level formatting, such as bold or italic, is removed. )rr#r+s rr#zParagraph.textsww||r cF|j|j|yr)r0r')rr#s rr#zParagraph.texts  Tr cb|jj}t||jS)zJReturn a newly created paragraph, inserted directly before this paragraph.)r add_p_beforer_parent)rrs rr;z"Paragraph._insert_paragraph_befores% GG "DLL))r )rrrzt.ProvidesStoryPart)NN)r# str | Noner$zstr | CharacterStyle | Nonereturnr)rYzWD_PARAGRAPH_ALIGNMENT | None)r-r)rYr2)rYzList[Hyperlink])r#rXr$str | ParagraphStyle | NonerYr)rYzIterator[Run | Hyperlink])rYzList[RenderedPageBreak])rYz List[Run])rYzParagraphStyle | None)rRrZ)rYstr)r#rX)__name__ __module__ __qualname____doc__rr'propertyr*setterr0r4r8r=rBrDrGrJr$r#r; __classcell__)rs@rrrs12$ !!""44SS MQ  .I    .. ZZ55  + + \\!!   [[*r r)!r_ __future__rtypingrrrrdocx.enum.stylerdocx.oxml.text.runr docx.sharedr docx.styles.styler docx.text.hyperlinkr docx.text.pagebreakr docx.text.parfmtr docx.text.runr docx.typestypestdocx.enum.textrdocx.oxml.text.paragraphrrrr rrssF$"66)#",)1,5-0V* V*r