
    h                        S r SSKJr  SSKJrJrJrJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  \(       a  SSKJr  SSKJr  SSKJr  SSKJr   " S S\5      r g)zParagraph-related proxy types.    )annotations)TYPE_CHECKINGIteratorListcast)WD_STYLE_TYPE)CT_R)
StoryChild)ParagraphStyle)	Hyperlink)RenderedPageBreak)ParagraphFormat)RunN)WD_PARAGRAPH_ALIGNMENT)CT_P)CharacterStylec                    ^  \ rS rSrSrSU 4S jjrSSS jjr\SS j5       r\R                  SS j5       rS r
\SS j5       r\SS	 j5       r S     SS
 jjrSS jr\S 5       r\SS j5       r\SS j5       r\S S j5       r\R                  S!S j5       r\S"S j5       r\R                  S#S j5       rS rSrU =r$ )$	Paragraph   z(Proxy object wrapping a `<w:p>` element.c                H   > [         [        U ]  U5        U=U l        U l        g N)superr   __init___p_element)selfpparent	__class__s      E/var/www/html/env/lib/python3.13/site-packages/docx/text/paragraph.pyr   Paragraph.__init__   s     i'/"##$-    c                    U R                   R                  5       n[        X05      nU(       a  Xl        U(       a  X$l        U$ )aS  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.
)r   add_rr   textstyle)r   r%   r&   rruns        r    add_runParagraph.add_run   s1     GGMMO!lHI
r"   c                .    U R                   R                  $ )aS  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   	alignmentr   s    r    r-   Paragraph.alignment.   s     ww   r"   c                $    XR                   l        g r   r,   )r   values     r    r-   r/   9   s    !r"   c                :    U R                   R                  5         U $ )zuReturn this same paragraph after removing all its content.

Paragraph-level formatting, such as style, is preserved.
)r   clear_contentr.   s    r    clearParagraph.clear=   s    
 	r"   c                @    [        U R                  R                  5      $ )zE`True` when one or more rendered page-breaks occur in this paragraph.)boolr   lastRenderedPageBreaksr.   s    r    contains_page_breakParagraph.contains_page_breakE   s     DGG2233r"   c                l    U R                   R                   Vs/ s H  n[        X5      PM     sn$ s  snf )z<A |Hyperlink| instance for each hyperlink in this paragraph.)r   hyperlink_lstr   )r   	hyperlinks     r    
hyperlinksParagraph.hyperlinksJ   s.     =AGG<Q<QR<Qy	)*<QRRR   1c                h    U R                  5       nU(       a  UR                  U5        Ub  X#l        U$ )zReturn a newly created paragraph, inserted directly before this paragraph.

If `text` is supplied, the new paragraph contains that text in a single run. If
`style` is provided, that style is assigned to the new paragraph.
)_insert_paragraph_beforer)   r&   )r   r%   r&   	paragraphs       r    insert_paragraph_before!Paragraph.insert_paragraph_beforeO   s4     113	d##Or"   c              #     #    U R                   R                   H0  n[        U[        5      (       a  [	        X5      O
[        X5      v   M2     g7f)a]  Generate the runs and hyperlinks in this paragraph, in the order they appear.

The content in a paragraph consists of both runs and hyperlinks. This method
allows accessing each of those separately, in document order, for when the
precise position of the hyperlink within the paragraph text is important. Note
that a hyperlink itself contains runs.
N)r   inner_content_elements
isinstancer	   r   r   )r   
r_or_hlinks     r    iter_inner_contentParagraph.iter_inner_content^   sA      ''88J j$// J%z0 9s   AAc                ,    [        U R                  5      $ )zThe |ParagraphFormat| object providing access to the formatting properties
for this paragraph, such as line spacing and indentation.)r   r   r.   s    r    paragraph_formatParagraph.paragraph_formatm   s     t}}--r"   c                l    U R                   R                   Vs/ s H  n[        X5      PM     sn$ s  snf )zAll rendered page-breaks in this paragraph.

Most often an empty list, sometimes contains one page-break, but can contain
more than one is rare or contrived cases.
)r   r8   r   )r   lrpbs     r    rendered_page_breaksParagraph.rendered_page_breakss   s.     ;?'':X:XY:X$!$-:XYYYr@   c                l    U R                   R                   Vs/ s H  n[        X5      PM     sn$ s  snf )zRSequence of |Run| instances corresponding to the <w:r> elements in this
paragraph.)r   r_lstr   )r   r'   s     r    runsParagraph.runs|   s(     '+ggmm4mAm444r@   c                    U R                   R                  nU R                  R                  U[        R
                  5      n[        [        U5      $ )a  Read/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.
)r   r&   part	get_styler   	PARAGRAPHr   r   )r   style_idr&   s      r    r&   Paragraph.style   s:     77==		##Hm.E.EFNE**r"   c                x    U R                   R                  U[        R                  5      nX R                  l        g r   )rX   get_style_idr   rZ   r   r&   )r   style_or_namer[   s      r    r&   r\      s'    99))-9P9PQ r"   c                .    U R                   R                  $ )aO  The 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 ``<w:tab/>`` 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.
)r   r%   r.   s    r    r%   Paragraph.text   s     ww||r"   c                F    U R                  5         U R                  U5        g r   )r4   r)   )r   r%   s     r    r%   ra      s    

Tr"   c                `    U R                   R                  5       n[        XR                  5      $ )zJReturn a newly created paragraph, inserted directly before this paragraph.)r   add_p_beforer   _parent)r   r   s     r    rB   "Paragraph._insert_paragraph_before   s#    GG  "LL))r"   )r   r   )r   r   r   zt.ProvidesStoryPart)NN)r%   
str | Noner&   zstr | CharacterStyle | Nonereturnr   )rh   zWD_PARAGRAPH_ALIGNMENT | None)r1   r   )rh   r7   )rh   zList[Hyperlink])r%   rg   r&   str | ParagraphStyle | Nonerh   r   )rh   zIterator[Run | Hyperlink])rh   zList[RenderedPageBreak])rh   z	List[Run])rh   zParagraphStyle | None)r_   ri   )rh   str)r%   rg   )__name__
__module____qualname____firstlineno____doc__r   r)   propertyr-   setterr4   r9   r>   rD   rJ   rM   rQ   rU   r&   r%   rB   __static_attributes____classcell__)r   s   @r    r   r      s6   2$  ! ! " " 4 4 S S
 MQ.I	 . .
 Z Z 5 5
 + + \\! !   
[[ * *r"   r   )!ro   
__future__r   typingr   r   r   r   docx.enum.styler   docx.oxml.text.runr	   docx.sharedr
   docx.styles.styler   docx.text.hyperlinkr   docx.text.pagebreakr   docx.text.parfmtr   docx.text.runr   
docx.typestypestdocx.enum.textr   docx.oxml.text.paragraphr   r   r    r"   r    <module>r      sF    $ " 6 6 ) # " , ) 1 , 5-0V*
 V*r"   