Ë
    \Rði*(  ã                  ó  — d Z ddlmZ ddlmZmZ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 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rddlmZ ddlmZ ddl m!Z!m"Z" ddlm#Z#  G d„ de«      Z$ G d„ d«      Z%y)z=Run-related proxy objects for python-docx, Run in particular.é    )Úannotations)ÚIOÚTYPE_CHECKINGÚIteratorÚcast)ÚDrawing)ÚWD_STYLE_TYPE)ÚWD_BREAK)Ú
CT_Drawing)ÚCT_LastRenderedPageBreak)ÚInlineShape)Ú
StoryChild)ÚCharacterStyle)ÚFont)ÚRenderedPageBreakN)ÚWD_UNDERLINE)ÚCT_RÚCT_Text)ÚLengthc                  óÂ  ‡ — e Zd ZdZdˆ fd„Zej                  fdd„Z	 	 d	 	 	 	 	 	 	 dd„Zdd„Z	dd„Z
edd„«       Zej                  dd„«       Zd	„ Zedd
„«       Zedd„«       Zedd„«       Zej                  dd„«       Zd d„Zd!d„Zed"d„«       Zej                  d#d„«       Zed$d„«       Zej                  dd„«       Zed%d„«       Zej                  d&d„«       Zˆ xZS )'ÚRunaI  Proxy object wrapping `<w:r>` element.

    Several of the properties on Run take a tri-state value, |True|, |False|, or |None|.
    |True| and |False| correspond to on and off respectively. |None| indicates the
    property is not specified directly on the run and its effective value is taken from
    the style hierarchy.
    c                óN   •— t         ‰| �  |«       |x| _        x| _        | _        y ©N)ÚsuperÚ__init__Ú_rÚ_elementÚelement)ÚselfÚrÚparentÚ	__class__s      €úH/var/www/html/Extract/venv/lib/python3.12/site-packages/docx/text/run.pyr   zRun.__init__"   s%   ø€ Ü‰Ñ˜Ô Ø12Ð2ˆŒÐ2�$”- $¥,ó    c                ó.  — t         j                  dt         j                  dt         j                  dt         j                  dt         j
                  dt         j                  di|   \  }}| j                  j                  «       }|�||_	        |�||_
        yy)a	  Add a break element of `break_type` to this run.

        `break_type` can take the values `WD_BREAK.LINE`, `WD_BREAK.PAGE`, and
        `WD_BREAK.COLUMN` where `WD_BREAK` is imported from `docx.enum.text`.
        `break_type` defaults to `WD_BREAK.LINE`.
        ©NN)ÚpageN)ÚcolumnN)ÚtextWrappingÚleft)r)   Úright)r)   ÚallN)r
   ÚLINEÚPAGEÚCOLUMNÚLINE_CLEAR_LEFTÚLINE_CLEAR_RIGHTÚLINE_CLEAR_ALLr   Úadd_brÚtypeÚclear)r   Ú
break_typeÚtype_r5   Úbrs        r#   Ú	add_breakzRun.add_break&   sŠ   € ô �M‰M˜<Ü�M‰M˜>Ü�O‰OÐ-Ü×$Ñ$Ð&>Ü×%Ñ%Ð'@Ü×#Ñ#Ð%<ð
ð ñ‰ˆˆuð �W‰W�^‰^ÓˆØÐØˆBŒGØÐØˆB�Hð r$   c                óˆ   — | j                   j                  |||«      }| j                  j                  |«       t	        |«      S )aÑ  Return |InlineShape| containing image identified by `image_path_or_stream`.

        The picture is added to the end of this run.

        `image_path_or_stream` can be a path (a string) or a file-like object containing
        a binary image.

        If neither width nor height is specified, the picture appears at
        its native size. If only one is specified, it is used to compute a scaling
        factor that is then applied to the unspecified dimension, preserving the aspect
        ratio of the image. The native size of the picture is calculated using the dots-
        per-inch (dpi) value specified in the image file, defaulting to 72 dpi if no
        value is specified, as is often the case.
        )ÚpartÚnew_pic_inliner   Úadd_drawingr   )r   Úimage_path_or_streamÚwidthÚheightÚinlines        r#   Úadd_picturezRun.add_picture;   s:   € ð( —‘×)Ñ)Ð*>ÀÀvÓNˆØ�‰×Ñ˜FÔ#Ü˜6Ó"Ð"r$   c                ó8   — | j                   j                  «        y)zcAdd a ``<w:tab/>`` element at the end of the run, which Word interprets as a
        tab character.N)r   Úadd_tab©r   s    r#   rD   zRun.add_tabS   s   € ð 	�‰�‰Õr$   c                óN   — | j                   j                  |«      }t        |«      S )zþReturns a newly appended |_Text| object (corresponding to a new ``<w:t>``
        child element) to the run, containing `text`.

        Compare with the possibly more friendly approach of assigning text to the
        :attr:`Run.text` property.
        )r   Úadd_tÚ_Text)r   ÚtextÚts      r#   Úadd_textzRun.add_textX   s   € ð �G‰G�M‰M˜$ÓˆÜ�Q‹xˆr$   c                ó.   — | j                   j                  S )a  Read/write tri-state value.

        When |True|, causes the text of the run to appear in bold face. When |False|,
        the text unconditionally appears non-bold. When |None| the bold setting for this
        run is inherited from the style hierarchy.
        ©ÚfontÚboldrE   s    r#   rO   zRun.boldb   s   € ð �y‰y�~‰~Ðr$   c                ó&   — || j                   _        y r   rM   ©r   Úvalues     r#   rO   zRun.boldl   s   € àˆ�	‰	�r$   c                ó:   — | j                   j                  «        | S )zoReturn reference to this run after removing all its content.

        All run formatting is preserved.
        )r   Úclear_contentrE   s    r#   r5   z	Run.clearp   s   € ð
 	�‰×ÑÔØˆr$   c                ó@   — t        | j                  j                  «      S )a¯  `True` when one or more rendered page-breaks occur in this run.

        Note that "hard" page-breaks inserted by the author are not included. A hard
        page-break gives rise to a rendered page-break in the right position so if those
        were included that page-break would be "double-counted".

        It would be very rare for multiple rendered page-breaks to occur in a single
        run, but it is possible.
        )Úboolr   ÚlastRenderedPageBreaksrE   s    r#   Úcontains_page_breakzRun.contains_page_breakx   s   € ô �D—G‘G×2Ñ2Ó3Ð3r$   c                ó,   — t        | j                  «      S )z{The |Font| object providing access to the character formatting properties for
        this run, such as font name and size.)r   r   rE   s    r#   rN   zRun.font…   s   € ô �D—M‘MÓ"Ð"r$   c                ó.   — | j                   j                  S )a	  Read/write tri-state value.

        When |True|, causes the text of the run to appear in italics. When |False|, the
        text unconditionally appears non-italic. When |None| the italic setting for this
        run is inherited from the style hierarchy.
        ©rN   ÚitalicrE   s    r#   r\   z
Run.italic‹   s   € ð �y‰y×ÑÐr$   c                ó&   — || j                   _        y r   r[   rQ   s     r#   r\   z
Run.italic•   s   € à ˆ�	‰	Õr$   c              #  óè   K  — | j                   j                  D ]U  }t        |t        «      r|–— Œt        |t        «      rt        || «      –— Œ7t        |t        «      sŒHt        || «      –— ŒW y­w)a'  Generate the content-items in this run in the order they appear.

        NOTE: only content-types currently supported by `python-docx` are generated. In
        this version, that is text and rendered page-breaks. Drawing is included but
        currently only provides access to its XML element (CT_Drawing) on its
        `._drawing` attribute. `Drawing` attributes and methods may be expanded in
        future releases.

        There are a number of element-types that can appear inside a run, but most of
        those (w:br, w:cr, w:noBreakHyphen, w:t, w:tab) have a clear plain-text
        equivalent. Any contiguous range of such elements is generated as a single
        `str`. Rendered page-break and drawing elements are generated individually. Any
        other elements are ignored.
        N)r   Úinner_content_itemsÚ
isinstanceÚstrr   r   r   r   )r   Úitems     r#   Úiter_inner_contentzRun.iter_inner_content™   s_   è ø€ ð —G‘G×/Ñ/ò 	*ˆDÜ˜$¤Ô$Ø“
Ü˜DÔ":Ô;Ü'¨¨dÓ3Ó3Ü˜D¤*Õ-Ü˜d DÓ)Ó)ñ	*ùs   ‚AA2Á!A2c                óp   — | j                   j                  |«       |j                   j                  |«       y)zªMark the range of runs from this run to `last_run` (inclusive) as belonging to a comment.

        `comment_id` identfies the comment that references this range.
        N)r   Ú insert_comment_range_start_aboveÚ,insert_comment_range_end_and_reference_below)r   Úlast_runÚ
comment_ids      r#   Úmark_comment_rangezRun.mark_comment_range°   s*   € ð 	�‰×0Ñ0°Ô<ð 	�‰×@Ñ@ÀÕLr$   c                óž   — | j                   j                  }t        t        | j                  j                  |t        j                  «      «      S )aa  Read/write.

        A |CharacterStyle| object representing the character style applied to this run.
        The default character style for the document (often `Default Character Font`) is
        returned if the run has no directly-applied character style. Setting this
        property to |None| removes any directly-applied character style.
        )r   Ústyler   r   r;   Ú	get_styler	   Ú	CHARACTER)r   Ústyle_ids     r#   rk   z	Run.style¼   s5   € ð —7‘7—=‘=ˆÜ”N D§I¡I×$7Ñ$7¸Ä-×BYÑBYÓ$ZÓ[Ð[r$   c                óz   — | j                   j                  |t        j                  «      }|| j                  _        y r   )r;   Úget_style_idr	   rm   r   rk   )r   Ústyle_or_namern   s      r#   rk   z	Run.styleÈ   s)   € à—9‘9×)Ñ)¨-¼×9PÑ9PÓQˆØ ˆ�‰�r$   c                ó.   — | j                   j                  S )a"  String formed by concatenating the text equivalent of each run.

        Each `<w:t>` element adds the text characters it contains. A `<w:tab/>` element
        adds a `\t` character. A `<w:cr/>` or `<w:br>` element each add a `\n`
        character. Note that a `<w:br>` element can indicate a page break or column
        break as well as a line break. Only line-break `<w:br>` elements translate to
        a `\n` character. Others are ignored. All other content child elements, such as
        `<w:drawing>`, are ignored.

        Assigning text to this property has the reverse effect, translating each `\t`
        character to a `<w:tab/>` element and each `\n` or `\r` character to a
        `<w:cr/>` element. Any existing run content is replaced. Run formatting is
        preserved.
        ©r   rI   rE   s    r#   rI   zRun.textÍ   s   € ð  �w‰w�|‰|Ðr$   c                ó&   — || j                   _        y r   rs   )r   rI   s     r#   rI   zRun.textß   s   € àˆ�‰�r$   c                ó.   — | j                   j                  S )a«  The underline style for this |Run|.

        Value is one of |None|, |True|, |False|, or a member of :ref:`WdUnderline`.

        A value of |None| indicates the run has no directly-applied underline value and
        so will inherit the underline value of its containing paragraph. Assigning
        |None| to this property removes any directly-applied underline value.

        A value of |False| indicates a directly-applied setting of no underline,
        overriding any inherited value.

        A value of |True| indicates single underline.

        The values from :ref:`WdUnderline` are used to specify other outline styles such
        as double, wavy, and dotted.
        ©rN   Ú	underlinerE   s    r#   rw   zRun.underlineã   s   € ð$ �y‰y×"Ñ"Ð"r$   c                ó&   — || j                   _        y r   rv   rQ   s     r#   rw   zRun.underline÷   s   € à#ˆ�	‰	Õr$   )r    r   r!   zt.ProvidesStoryPart)r6   r
   r&   )r>   zstr | IO[bytes]r?   úint | Length | Noner@   ry   Úreturnr   )rz   ÚNone)rI   ra   )rz   úbool | None)rR   r|   )rz   rV   )rz   r   )rz   z+Iterator[str | Drawing | RenderedPageBreak])rg   r   rh   Úintrz   r{   )rz   r   )rq   zstr | CharacterStyle | None)rz   ra   )rz   úbool | WD_UNDERLINE | None)rR   r~   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r
   r-   r9   rB   rD   rK   ÚpropertyrO   Úsetterr5   rX   rN   r\   rc   ri   rk   rI   rw   Ú__classcell__©r"   s   @r#   r   r      sp  ø„ ñõ3ð 08¯}©}ô ð0 &*Ø&*ð	#à-ð#ð #ð#ð $ð	#ð
 
ó#ó0ó
ð òó ðð 
‡[�[òó ðòð ò
4ó ð
4ð ò#ó ð#ð
 ò ó ð ð ‡]�]ò!ó ð!ó*ó.
Mð ò	\ó ð	\ð ‡\�\ò!ó ð!ð òó ðð" 
‡[�[òó ðð ò#ó ð#ð& ×Ñò$ó ô$r$   r   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )rH   z&Proxy object wrapping `<w:t>` element.c                ó8   •— t         t        | �  «        || _        y r   )r   rH   r   Ú_t)r   Út_elmr"   s     €r#   r   z_Text.__init__ÿ   s   ø€ ÜŒe�TÑ#Ô%Øˆ�r$   )rŠ   r   )r   r€   r�   r‚   r   r…   r†   s   @r#   rH   rH   ü   s   ø„ Ù0÷ñ r$   rH   )&r‚   Ú
__future__r   Útypingr   r   r   r   Údocx.drawingr   Údocx.enum.styler	   Údocx.enum.textr
   Údocx.oxml.drawingr   Údocx.oxml.text.pagebreakr   Ú
docx.shaper   Údocx.sharedr   Údocx.styles.styler   Údocx.text.fontr   Údocx.text.pagebreakr   Ú
docx.typesÚtypesrJ   r   Údocx.oxml.text.runr   r   r   r   rH   © r$   r#   ú<module>r›      sW   ðÙ Cå "ç 4Ó 4å  Ý )Ý #Ý (Ý =Ý "Ý "Ý ,Ý Ý 1áÝÝ+ß0Ý"ô`$ˆ*ô `$÷Fò r$   