HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/docx/text/__pycache__/parfmt.cpython-310.pyc
o

$wec(�@sPdZddlmZddlmZmZmZmZmZm	Z	ddl
mZGdd�de�ZdS)zParagraph-related proxy types.�)�WD_LINE_SPACING)�ElementProxy�Emu�Length�Pt�Twips�lazyproperty)�TabStopsc@sleZdZdZedd��Zejdd��Zedd��Zejdd��Zedd	��Zejd
d	��Zedd��Z	e	jd
d��Z	edd��Z
e
jdd��Z
edd��Zejdd��Zedd��Zejdd��Zedd��Z
e
jdd��Z
edd��Zejdd��Zedd��Zejdd��Zed d!��Zejd"d!��Zed#d$��Zed%d&��Zejd'd&��Zed(d)��Zed*d+��Zd,S)-�ParagraphFormatz�Provides access to paragraph formatting such as justification, indentation, line
    spacing, space before and after, and widow/orphan control.cC�|jj}|dur
dS|jS)z�A member of the :ref:`WdParagraphAlignment` enumeration specifying the
        justification setting for this paragraph.

        A value of |None| indicates paragraph alignment is inherited from the style
        hierarchy.
        N)�_element�pPr�jc_val��selfr
�r�I/home/arjun/projects/env/lib/python3.10/site-packages/docx/text/parfmt.py�	alignmentszParagraphFormat.alignmentcC�|j��}||_dS�N)r�get_or_add_pPrr�r�valuer
rrrr�

cCr)aA|Length| value specifying the relative difference in indentation for the
        first line of the paragraph.

        A positive value causes the first line to be indented. A negative value produces
        a hanging indent. |None| indicates first line indentation is inherited from the
        style hierarchy.
        N)rr
�first_line_indentrrrrr�	z!ParagraphFormat.first_line_indentcCrr)rrrrrrrr,rcCr)z�|True| if the paragraph should be kept "in one piece" and not broken across a
        page boundary when the document is rendered.

        |None| indicates its effective value is inherited from the style hierarchy.
        N)rr
�
keepLines_valrrrr�
keep_together1�zParagraphFormat.keep_togethercC�||j��_dSr)rrr�rrrrrr=�cCr)aT|True| if the paragraph should be kept on the same page as the subsequent
        paragraph when the document is rendered.

        For example, this property could be used to keep a section heading on the same
        page as its first paragraph. |None| indicates its effective value is inherited
        from the style hierarchy.
        N)rr
�keepNext_valrrrr�keep_with_nextArzParagraphFormat.keep_with_nextcCrr)rrr"r rrrr#Or!cCr)a1|Length| value specifying the space between the left margin and the left side
        of the paragraph.

        |None| indicates the left indent value is inherited from the style hierarchy.
        Use an |Inches| value object as a convenient way to apply indentation in units
        of inches.
        N)rr
�ind_leftrrrr�left_indentSrzParagraphFormat.left_indentcCrr)rrr$rrrrr%arcC�$|jj}|dur
dS|�|j|j�S)aB|float| or |Length| value specifying the space between baselines in
        successive lines of the paragraph.

        A value of |None| indicates line spacing is inherited from the style hierarchy.
        A float value, e.g. ``2.0`` or ``1.75``, indicates spacing is applied in
        multiples of line heights. A |Length| value such as ``Pt(12)`` indicates spacing
        is a fixed height. The |Pt| value class is a convenient way to apply line
        spacing in units of points. Assigning |None| resets line spacing to inherit from
        the style hierarchy.
        N)rr
�
_line_spacing�spacing_line�spacing_lineRulerrrr�line_spacingfszParagraphFormat.line_spacingcCsl|j��}|durd|_d|_dSt|t�r'||_|jtjkr%tj|_dSdSt	|t
d��|_tj|_dS)N��)rrr(r)�
isinstancerr�AT_LEAST�EXACTLYrr�MULTIPLErrrrr*ws


�cCr&)atA member of the :ref:`WdLineSpacing` enumeration indicating how the value of
        :attr:`line_spacing` should be interpreted.

        Assigning any of the :ref:`WdLineSpacing` members :attr:`SINGLE`,
        :attr:`DOUBLE`, or :attr:`ONE_POINT_FIVE` will cause the value of
        :attr:`line_spacing` to be updated to produce the corresponding line spacing.
        N)rr
�_line_spacing_ruler(r)rrrr�line_spacing_rule�s	z!ParagraphFormat.line_spacing_rulecCst|j��}|tjkrtd�|_tj|_dS|tjkr%td�|_tj|_dS|tj	kr5td�|_tj|_dS||_dS)Nr+�h��)
rrr�SINGLErr(r/r)�ONE_POINT_FIVE�DOUBLErrrrr1�s







cCr)z�|True| if the paragraph should appear at the top of the page following the
        prior paragraph.

        |None| indicates its effective value is inherited from the style hierarchy.
        N)rr
�pageBreakBefore_valrrrr�page_break_before�rz!ParagraphFormat.page_break_beforecCrr)rrr7r rrrr8�r!cCr)a4|Length| value specifying the space between the right margin and the right
        side of the paragraph.

        |None| indicates the right indent value is inherited from the style hierarchy.
        Use a |Cm| value object as a convenient way to apply indentation in units of
        centimeters.
        N)rr
�	ind_rightrrrr�right_indent�rzParagraphFormat.right_indentcCrr)rrr9rrrrr:�rcCr)ao|Length| value specifying the spacing to appear between this paragraph and
        the subsequent paragraph.

        |None| indicates this value is inherited from the style hierarchy. |Length|
        objects provide convenience properties, such as :attr:`~.Length.pt` and
        :attr:`~.Length.inches`, that allow easy conversion to various length units.
        N)rr
�
spacing_afterrrrr�space_after�rzParagraphFormat.space_aftercCrr)rrr;r rrrr<�r!cCr)af|Length| value specifying the spacing to appear between this paragraph and
        the prior paragraph.

        |None| indicates this value is inherited from the style hierarchy. |Length|
        objects provide convenience properties, such as :attr:`~.Length.pt` and
        :attr:`~.Length.cm`, that allow easy conversion to various length units.
        N)rr
�spacing_beforerrrr�space_before�rzParagraphFormat.space_beforecCrr)rrr=r rrrr>�r!cCs|j��}t|�S)z^|TabStops| object providing access to the tab stops defined for this
        paragraph format.)rrr	rrrr�	tab_stops�s
zParagraphFormat.tab_stopscCr)z�|True| if the first and last lines in the paragraph remain on the same page
        as the rest of the paragraph when Word repaginates the document.

        |None| indicates its effective value is inherited from the style hierarchy.
        N)rr
�widowControl_valrrrr�
widow_control�rzParagraphFormat.widow_controlcCrr)rrr@r rrrrA�r!cCs&|durdS|tjkr|td�S|S)a[Return the line spacing value calculated from the combination of
        `spacing_line` and `spacing_lineRule`.

        Returns a |float| number of lines when `spacing_lineRule` is
        ``WD_LINE_SPACING.MULTIPLE``, otherwise a |Length| object of absolute line
        height is returned. Returns |None| when `spacing_line` is |None|.
        N�)rr/r)r(r)rrrr's
	
zParagraphFormat._line_spacingcCsD|tjkr |td�krtjS|td�krtjS|td�kr tjS|S)z�Return the line spacing rule value calculated from the combination of `line`
        and `lineRule`.

        Returns special members of the :ref:`WdLineSpacing` enumeration when line
        spacing is single, double, or 1.5 lines.
        r+r2r3)rr/rr4r5r6)�line�lineRulerrrr0s
z"ParagraphFormat._line_spacing_ruleN)�__name__�
__module__�__qualname__�__doc__�propertyr�setterrrr#r%r*r1r8r:r<r>rr?rA�staticmethodr'r0rrrrr
sp

























r
N)
rH�docx.enum.textr�docx.sharedrrrrrr�docx.text.tabstopsr	r
rrrr�<module>s