;idZddlmZddlmZmZmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZerdd lmZdd lmZddlmZddlmZGdde Z d S)zParagraph-related proxy types.) annotations) TYPE_CHECKINGIteratorListcast) WD_STYLE_TYPE)CT_R) StoryChild)ParagraphStyle HyperlinkRenderedPageBreak)ParagraphFormatRunN)WD_PARAGRAPH_ALIGNMENT)CT_P)CharacterStylecreZdZdZd*fd Zd+d,dZed-dZejd.dZdZ ed/dZ ed0dZ d+d1dZ d2dZ edZed3dZed4d!Zed5d#Zejd6d%Zed7d'Zejd8d(Zd)ZxZS)9 Paragraphz(Proxy object wrapping a `` element.prparentt.ProvidesStoryPartcttt|||x|_|_dSN)superr__init___p_element)selfrr __class__s GC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\docx/text/paragraph.pyrzParagraph.__init__s3 i''///"##$---Ntext str | Nonestylestr | CharacterStyle | Nonereturnrc||j}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_rrr%r')r!r%r'rruns r#add_runzParagraph.add_runsC GMMOO!Tll  CH  CI r$WD_PARAGRAPH_ALIGNMENT | Nonec|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 alignmentr!s r#r2zParagraph.alignment.sw  r$valuerc||j_dSrr1)r!r4s r#r2zParagraph.alignment9s!r$c8|j|S)zReturn this same paragraph after removing all its content. Paragraph-level formatting, such as style, is preserved. )r clear_contentr3s r#clearzParagraph.clear=s  r$boolc4t|jjS)zE`True` when one or more rendered page-breaks occur in this paragraph.)r9rlastRenderedPageBreaksr3s r#contains_page_breakzParagraph.contains_page_breakEsDG2333r$List[Hyperlink]c4fdjjDS)zz(Paragraph.hyperlinks..Ms#RRRy )T**RRRr$)r hyperlink_lstr3s`r# hyperlinkszParagraph.hyperlinksJs%SRRRDG.zs$YYY$!$--YYYr$)rr;r3s`r#rendered_page_breakszParagraph.rendered_page_breaksss%ZYYY$':XYYYYr$ List[Run]c4fdjjDS)zZSequence of |Run| instances corresponding to the elements in this paragraph.c0g|]}t|Sr@r)rAr,r!s r#rCz"Paragraph.runs..s!444At 444r$)rr_lstr3s`r#runszParagraph.runs|s#5444dgm4444r$ParagraphStyle | Nonec|jj}|j|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 )r!style_idr's r#r'zParagraph.styles77= ##Hm.EFFNE***r$ style_or_namech|j|tj}||j_dSr)r_ get_style_idrrarr')r!rcrbs r#r'zParagraph.styles)9))-9PQQ  r$strc|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%r3s r#r%zParagraph.textsw|r$cX|||dSr)r8r.)r!r%s r#r%zParagraph.texts'  Tr$c^|j}t||jS)zJReturn a newly created paragraph, inserted directly before this paragraph.)r add_p_beforer_parent)r!rs r#rHz"Paragraph._insert_paragraph_befores' G " "DL)))r$)rrrr)NN)r%r&r'r(r)r)r)r/)r4r)r)r9)r)r=)r%r&r'rFr)r)r)rK)r)rS)r)rX)r)r])rcrF)r)rf)r%r&)__name__ __module__ __qualname____doc__rr.propertyr2setterr8r<rErJrPrRrWr\r'r%rH __classcell__)r"s@r#rrs22$$$$$$ !!!X!""""444X4SSSXS MQ         ..X. ZZZXZ555X5  + + +X + \!!!\!   X  [[*******r$r)!ro __future__rtypingrrrrdocx.enum.stylerdocx.oxml.text.runr docx.sharedr docx.styles.styler docx.text.hyperlinkr docx.text.pagebreakrdocx.text.parfmtr docx.text.runr docx.typestypestdocx.enum.textrdocx.oxml.text.paragraphrrrr@r$r#rs_$$""""""666666666666))))))######"""""",,,,,,))))))111111,,,,,,1555555------000000V*V*V*V*V* V*V*V*V*V*r$