Xjc(VdZddlmZddlmZmZmZmZmZm Z ddl m Z GddeZ y)zParagraph-related proxy types.)WD_LINE_SPACING) ElementProxyEmuLengthPtTwips lazyproperty)TabStopsceZdZdZedZej dZedZej dZedZej dZedZ e j d Z ed Z e j d Z ed Z e j d Z edZ e j dZ edZ e j dZ edZej dZedZej dZedZej dZedZedZej dZedZedZy)ParagraphFormatzProvides access to paragraph formatting such as justification, indentation, line spacing, space before and after, and widow/orphan control.cL|jj}|y|jS)zA 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)_elementpPrjc_valselfrs d/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/docx/text/parfmt.py alignmentzParagraphFormat.alignment s%mm ;zzcF|jj}||_yN)rget_or_add_pPrrrvaluers rrzParagraphFormat.alignmentsmm**, rcL|jj}|y|jS)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)rrfirst_line_indentrs rrz!ParagraphFormat.first_line_indents'mm ;$$$rcF|jj}||_yr)rrrrs rrz!ParagraphFormat.first_line_indent,smm**, %rcL|jj}|y|jS)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)rr keepLines_valrs r keep_togetherzParagraphFormat.keep_together1s'mm ;   rcB||jj_yr)rrrrrs rr zParagraphFormat.keep_together=7< $$&4rcL|jj}|y|jS)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)rr keepNext_valrs rkeep_with_nextzParagraphFormat.keep_with_nextAs'mm ;rcB||jj_yr)rrr%r"s rr&zParagraphFormat.keep_with_nextOs6; $$&3rcL|jj}|y|jS)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)rrind_leftrs r left_indentzParagraphFormat.left_indentSs%mm ;||rcF|jj}||_yr)rrr)rs rr*zParagraphFormat.left_indentasmm**, rc|jj}|y|j|j|jS)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)rr _line_spacing spacing_linespacing_lineRulers r line_spacingzParagraphFormat.line_spacingfs:mm ;!!#"2"2C4H4HIIrcR|jj}|d|_d|_yt |t r;||_|jt jk7rt j|_yyt|tdz|_t j|_y)N) rrr.r/ isinstancerrAT_LEASTEXACTLYrrMULTIPLErs rr0zParagraphFormat.line_spacingwsmm**, =#C #'C v &$C ##'?'??'6'>'>$@ #55:#56C #2#;#;C rc|jj}|y|j|j|jS)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)rr_line_spacing_ruler.r/rs rline_spacing_rulez!ParagraphFormat.line_spacing_rules:mm ;&&s'7'79M9MNNrc|jj}|tjk(r&t d|_tj |_y|tjk(r&t d|_tj |_y|tjk(r&t d|_tj |_y||_y)Nr2h) rrrSINGLErr.r6r/ONE_POINT_FIVEDOUBLErs rr9z!ParagraphFormat.line_spacing_rulesmm**, O** *$SzC #2#;#;C o44 4$SzC #2#;#;C o,, ,$SzC #2#;#;C #(C rcL|jj}|y|jS)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)rrpageBreakBefore_valrs rpage_break_beforez!ParagraphFormat.page_break_befores'mm ;&&&rcB||jj_yr)rrrAr"s rrBz!ParagraphFormat.page_break_befores=B $$&:rcL|jj}|y|jS)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)rr ind_rightrs r right_indentzParagraphFormat.right_indents%mm ;}}rcF|jj}||_yr)rrrErs rrFzParagraphFormat.right_indentsmm**, rcL|jj}|y|jS)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)rr spacing_afterrs r space_afterzParagraphFormat.space_afters'mm ;   rcB||jj_yr)rrrIr"s rrJzParagraphFormat.space_afterr#rcL|jj}|y|jS)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)rrspacing_beforers r space_beforezParagraphFormat.space_befores'mm ;!!!rcB||jj_yr)rrrMr"s rrNzParagraphFormat.space_befores8= $$&5rcL|jj}t|S)z^|TabStops| object providing access to the tab stops defined for this paragraph format.)rrr rs r tab_stopszParagraphFormat.tab_stopss mm**,}rcL|jj}|y|jS)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)rrwidowControl_valrs r widow_controlzParagraphFormat.widow_controls'mm ;###rcB||jj_yr)rrrSr"s rrTzParagraphFormat.widow_controls:? $$&7rcN|y|tjk(r|tdz 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 )rr6r)r.r/s rr-zParagraphFormat._line_spacings0   77 7"R&( (rc|tjk(rZ|tdk(rtjS|tdk(rtjS|tdk(rtj S|S)zReturn 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. r2r;r<)rr6rr=r>r?)linelineRules rr8z"ParagraphFormat._line_spacing_rules_ // /uSz!&---uSz!&555uSz!&---rN)__name__ __module__ __qualname____doc__propertyrsetterrr r&r*r0r9rBrFrJrNr rQrT staticmethodr-r8rrr r stB   % %&& ! !==    <<  JJ  < < O O ) ) ' 'CC   ! !== " ">>  $ $@@  rr N) r^docx.enum.textr docx.sharedrrrrrr docx.text.tabstopsr r rbrrrfs"$*JJ'VlVr