§
    £”j*(  ã                  ó  — 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%dS )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d3ˆ fd„Zej        fd4d	„Z	 	 d5d6d„Zd7d„Z	d8d„Z
ed9d„¦   «         Zej        d:d„¦   «         Zd„ Zed;d„¦   «         Zed<d „¦   «         Zed9d!„¦   «         Zej        d:d"„¦   «         Zd=d$„Zd>d(„Zed?d*„¦   «         Zej        d@d-„¦   «         ZedAd.„¦   «         Zej        d8d/„¦   «         ZedBd1„¦   «         Zej        dCd2„¦   «         Zˆ xZS )DÚ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.
    Úrr   Úparentút.ProvidesStoryPartc                ót   •— t          ¦   «                              |¦  «         |x| _        x| _        | _        d S ©N)ÚsuperÚ__init__Ú_rÚ_elementÚelement)Úselfr   r   Ú	__class__s      €ú\/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/docx/text/run.pyr   zRun.__init__"   s4   ø€ Ý‰Œ×Ò˜Ñ Ô Ð Ø12Ð2ˆŒÐ2�$”- $¤, , ,ó    Ú
break_typer
   c                ó  — t           j        dt           j        dt           j        dt           j        dt           j        dt           j        di|         \  }}| j                             ¦   «         }|�||_	        |�	||_
        dS dS )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"   r&   Útype_r7   Úbrs        r$   Ú	add_breakzRun.add_break&   sƒ   € õ ŒM˜<ÝŒM˜>ÝŒOÐ-ÝÔ$Ð&>ÝÔ%Ð'@ÝÔ#Ð%<ð
ð ô‰ˆˆuð ŒW�^Š^ÑÔˆØÐØˆBŒGØÐØˆBŒHˆHˆHð Ðr%   NÚimage_path_or_streamústr | IO[bytes]Úwidthúint | Length | NoneÚheightÚreturnr   c                óŒ   — | 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"   r;   r=   r?   Úinlines        r$   Úadd_picturezRun.add_picture;   sB   € ð( ”×)Ò)Ð*>ÀÀvÑNÔNˆØŒ×Ò˜FÑ#Ô#Ð#Ý˜6Ñ"Ô"Ð"r%   ÚNonec                ó8   — | j                              ¦   «          dS )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$   rI   zRun.add_tabS   s   € ð 	Œ�ŠÑÔÐÐÐr%   ÚtextÚstrc                óT   — | 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"   rK   Úts      r$   Úadd_textzRun.add_textX   s"   € ð ŒG�MŠM˜$ÑÔˆÝ�Q‰xŒxˆr%   úbool | Nonec                ó   — | 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ÚboldrJ   s    r$   rV   zRun.boldb   s   € ð ŒyŒ~Ðr%   Úvaluec                ó   — || j         _        d S r   rT   ©r"   rW   s     r$   rV   zRun.boldl   s   € àˆŒ	Œˆˆr%   c                ó8   — | j                              ¦   «          | S )zoReturn reference to this run after removing all its content.

        All run formatting is preserved.
        )r   Úclear_contentrJ   s    r$   r7   z	Run.clearp   s   € ð
 	Œ×ÒÑÔÐØˆr%   Úboolc                ó4   — 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.
        )r\   r   ÚlastRenderedPageBreaksrJ   s    r$   Úcontains_page_breakzRun.contains_page_breakx   s   € õ �D”GÔ2Ñ3Ô3Ð3r%   r   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    rJ   s    r$   rU   zRun.font…   s   € õ �D”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.
        ©rU   ÚitalicrJ   s    r$   rc   z
Run.italic‹   s   € ð ŒyÔÐr%   c                ó   — || j         _        d S r   rb   rY   s     r$   rc   z
Run.italic•   s   € à ˆŒ	ÔÐÐr%   ú+Iterator[str | Drawing | RenderedPageBreak]c              #  óú   K  — | j         j        D ]k}t          |t          ¦  «        r|V — Œt          |t          ¦  «        rt          || ¦  «        V — ŒDt          |t          ¦  «        rt          || ¦  «        V — ŒldS )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Ú
isinstancerL   r   r   r   r   )r"   Úitems     r$   Úiter_inner_contentzRun.iter_inner_content™   s˜   è è € ð ”GÔ/ð 	*ð 	*ˆDÝ˜$¥Ñ$Ô$ð *Ø�
�
�
�
Ý˜DÕ":Ñ;Ô;ð *Ý'¨¨dÑ3Ô3Ð3Ð3Ð3Ð3Ý˜D¥*Ñ-Ô-ð *Ý˜d DÑ)Ô)Ð)Ð)Ð)øð	*ð 	*r%   Úlast_runÚ
comment_idÚintc                ón   — | j                              |¦  «         |j                              |¦  «         dS )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"   rk   rl   s      r$   Úmark_comment_rangezRun.mark_comment_range°   s8   € ð 	Œ×0Ò0°Ñ<Ô<Ð<ð 	Œ×@Ò@ÀÑLÔLÐLÐLÐLr%   r   c                óŠ   — | j         j        }t          t          | 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   rB   Ú	get_styler	   Ú	CHARACTER)r"   Ústyle_ids     r$   rs   z	Run.style¼   s2   € ð ”7”=ˆÝ•N D¤I×$7Ò$7¸Å-ÔBYÑ$ZÔ$ZÑ[Ô[Ð[r%   Ústyle_or_nameústr | CharacterStyle | Nonec                óh   — | j                              |t          j        ¦  «        }|| j        _        d S r   )rB   Úget_style_idr	   ru   r   rs   )r"   rw   rv   s      r$   rs   z	Run.styleÈ   s)   € à”9×)Ò)¨-½Ô9PÑQÔ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   rK   rJ   s    r$   rK   zRun.textÍ   s   € ð  ŒwŒ|Ðr%   c                ó   — || j         _        d S r   r|   )r"   rK   s     r$   rK   zRun.textß   s   € àˆŒŒˆˆr%   úbool | WD_UNDERLINE | Nonec                ó   — | 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.
        ©rU   Ú	underlinerJ   s    r$   r�   zRun.underlineã   s   € ð$ ŒyÔ"Ð"r%   c                ó   — || j         _        d S r   r€   rY   s     r$   r�   zRun.underline÷   s   € à#ˆŒ	ÔÐÐr%   )r   r   r   r   )r&   r
   r(   )r;   r<   r=   r>   r?   r>   r@   r   )r@   rG   )rK   rL   )r@   rR   )rW   rR   )r@   r\   )r@   r   )r@   re   )rk   r   rl   rm   r@   rG   )r@   r   )rw   rx   )r@   rL   )r@   r~   )rW   r~   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r
   r/   r:   rF   rI   rQ   ÚpropertyrV   Úsetterr7   r_   rU   rc   rj   rq   rs   rK   r�   Ú__classcell__©r#   s   @r$   r   r      s{  ø€ € € € € ðð ð3ð 3ð 3ð 3ð 3ð 3ð 08¬}ð ð ð ð ð ð0 &*Ø&*ð	#ð #ð #ð #ð #ð0ð ð ð ð
ð ð ð ð ðð ð ñ „Xðð 
„[ðð ð ñ „[ððð ð ð ð
4ð 
4ð 
4ñ „Xð
4ð ð#ð #ð #ñ „Xð#ð
 ð ð  ð  ñ „Xð ð „]ð!ð !ð !ñ „]ð!ð*ð *ð *ð *ð.
Mð 
Mð 
Mð 
Mð ð	\ð 	\ð 	\ñ „Xð	\ð „\ð!ð !ð !ñ „\ð!ð ðð ð ñ „Xðð" 
„[ðð ð ñ „[ðð ð#ð #ð #ñ „Xð#ð& Ôð$ð $ð $ñ Ôð$ð $ð $ð $ð $r%   r   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )rO   z&Proxy object wrapping `<w:t>` element.Út_elmr   c                ód   •— t          t          | ¦  «                             ¦   «          || _        d S r   )r   rO   r   Ú_t)r"   rŒ   r#   s     €r$   r   z_Text.__init__ÿ   s*   ø€ Ý�e�TÑÔ×#Ò#Ñ%Ô%Ð%ØˆŒˆˆr%   )rŒ   r   )rƒ   r„   r…   r†   r   r‰   rŠ   s   @r$   rO   rO   ü   sC   ø€ € € € € Ø0Ð0ðð ð ð ð ð ð ð ð ð r%   rO   )&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ÚtypesrP   r   Údocx.oxml.text.runr   r   r   r   rO   © r%   r$   ú<module>rŸ      s°  ðØ CÐ Cà "Ð "Ð "Ð "Ð "Ð "à 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4à  Ð  Ð  Ð  Ð  Ð  Ø )Ð )Ð )Ð )Ð )Ð )Ø #Ð #Ð #Ð #Ð #Ð #Ø (Ð (Ð (Ð (Ð (Ð (Ø =Ð =Ð =Ð =Ð =Ð =Ø "Ð "Ð "Ð "Ð "Ð "Ø "Ð "Ð "Ð "Ð "Ð "Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø Ð Ð Ð Ð Ð Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1àð #ØÐÐÐÐÐØ+Ð+Ð+Ð+Ð+Ð+Ø0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ø"Ð"Ð"Ð"Ð"Ð"ð`$ð `$ð `$ð `$ð `$ˆ*ñ `$ô `$ð `$ðFð ð ð ð ñ ô ð ð ð r%   