
    Pqh+                       d Z ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
 ddlmZmZ ddlmZmZmZmZmZ ddlmZ erddlmZ dd	lmZ  G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)z@Custom element classes related to paragraph properties (CT_PPr).    )annotations)TYPE_CHECKINGCallable)WD_ALIGN_PARAGRAPHWD_LINE_SPACINGWD_TAB_ALIGNMENTWD_TAB_LEADER)ST_SignedTwipsMeasureST_TwipsMeasure)BaseOxmlElement	OneOrMoreOptionalAttributeRequiredAttribute	ZeroOrOne)Length)	CT_SectPr)	CT_Stringc                  X    e Zd ZdZ ede      Z ede      Z ede      Z	 ede      Z
y)CT_Indz6``<w:ind>`` element, specifying paragraph indentation.zw:leftzw:rightzw:firstLinez	w:hangingN)__name__
__module____qualname____doc__r   r
   leftrightr   	firstLinehanging     V/srv/www/ollama/chat-ollama/venv/lib/python3.12/site-packages/docx/oxml/text/parfmt.pyr   r      s7    @X'<=Di)>?E!-AI_=Gr   r   c                  "    e Zd ZdZ ede      Zy)CT_Jcz7``<w:jc>`` element, specifying paragraph justification.w:valN)r   r   r   r   r   r   valr   r   r    r"   r"   %   s    A
G%7
8Cr   r"   c                     e Zd ZU dZded<   ded<   ded<   ded<   d	Z ed
edd       Zded<    ededd       Z ededd       Z	 ededd       Z
 ededd       Z ededd       Z ededd       Z ededd       Z ededd       Z ed ed!d       Z ed"ed#d       Z[ed$        Zej(                  d%        Zed&        Zej(                  d'        Zed(        Zej(                  d)        Zed>d*       Zej(                  d+        Zed,        Zej(                  d-        Zed.        Zej(                  d/        Zed0        Zej(                  d1        Zed2        Zej(                  d3        Zed4        Zej(                  d5        Zed6        Zej(                  d7        Zed8        Zej(                  d9        Zed?d:       Zej(                  d@d;       Zed<        Z e j(                  d=        Z y)ACT_PPrz?``<w:pPr>`` element, containing the properties for a paragraph.zCallable[[], CT_String]get_or_add_pStylezCallable[[CT_SectPr], None]_insert_sectPrzCallable[[], None]_remove_pStyle_remove_sectPr)$w:pStyle
w:keepNextw:keepLinesw:pageBreakBeforez	w:framePrw:widowControlw:numPrzw:suppressLineNumberszw:pBdrzw:shdw:tabszw:suppressAutoHyphensz	w:kinsokuz
w:wordWrapzw:overflowPunctzw:topLinePunctzw:autoSpaceDEzw:autoSpaceDNzw:bidizw:adjustRightIndzw:snapToGrid	w:spacingw:indzw:contextualSpacingzw:mirrorIndentszw:suppressOverlapw:jczw:textDirectionzw:textAlignmentzw:textboxTightWrapzw:outlineLvlzw:divIdz
w:cnfStylezw:rPrw:sectPrzw:pPrChanger+      N
successorszCT_String | NonepStyler,      r-      r.      r/      r0      r1      r2      r3      r4      r5   #   c                v    | j                   }|y|j                  }|t        |       S |j                  }|y|S )zA |Length| value calculated from the values of `w:ind/@w:firstLine` and
        `w:ind/@w:hanging`.

        Returns |None| if the `w:ind` child is not present.
        N)indr   r   r   )selfrE   r   r   s       r    first_line_indentzCT_PPr.first_line_indenth   sI     hh;++7(##MM	r   c                    | j                   |y | j                         }d x|_        |_        |y |dk  r	| |_        y ||_        y )Nr   )rE   get_or_add_indr   r   rF   valuerE   s      r    rG   zCT_PPr.first_line_indentz   sN    88!!#&**=QY &CK!CMr   c                8    | j                   }|y|j                  S )z6The value of `w:ind/@w:left` or |None| if not present.N)rE   r   rF   rE   s     r    ind_leftzCT_PPr.ind_left   s     hh;xxr   c                P    || j                   y | j                         }||_        y N)rE   rI   r   rJ   s      r    rN   zCT_PPr.ind_left   s(    =TXX-!!#r   c                8    | j                   }|y|j                  S )z7The value of `w:ind/@w:right` or |None| if not present.N)rE   r   rM   s     r    	ind_rightzCT_PPr.ind_right   s     hh;yyr   c                P    || j                   y | j                         }||_        y rP   )rE   rI   r   rJ   s      r    rR   zCT_PPr.ind_right   s(    =TXX-!!#	r   c                J    | j                   | j                   j                  S dS )z=Value of the `<w:jc>` child element or |None| if not present.N)jcr$   rF   s    r    jc_valzCT_PPr.jc_val   s      #gg1tww{{;t;r   c                T    || j                          y || j                         _        y rP   )
_remove_jcget_or_add_jcr$   rF   rK   s     r    rW   zCT_PPr.jc_val   s%    =OO#( r   c                8    | j                   }|y|j                  S )z7The value of `keepLines/@val` or |None| if not present.N)	keepLinesr$   )rF   r]   s     r    keepLines_valzCT_PPr.keepLines_val   s      NN	}}r   c                T    || j                          y || j                         _        y rP   )_remove_keepLinesget_or_add_keepLinesr$   r[   s     r    r^   zCT_PPr.keepLines_val   s$    =""$.3D%%'+r   c                8    | j                   }|y|j                  S )z6The value of `keepNext/@val` or |None| if not present.N)keepNextr$   )rF   rc   s     r    keepNext_valzCT_PPr.keepNext_val   s      ==||r   c                T    || j                          y || j                         _        y rP   )_remove_keepNextget_or_add_keepNextr$   r[   s     r    rd   zCT_PPr.keepNext_val   s$    =!!#-2D$$&*r   c                8    | j                   }|y|j                  S )z=The value of `pageBreakBefore/@val` or |None| if not present.N)pageBreakBeforer$   )rF   ri   s     r    pageBreakBefore_valzCT_PPr.pageBreakBefore_val   s$     ..""""r   c                T    || j                          y || j                         _        y rP   )_remove_pageBreakBeforeget_or_add_pageBreakBeforer$   r[   s     r    rj   zCT_PPr.pageBreakBefore_val   s$    =((*49D++-1r   c                8    | j                   }|y|j                  S )z;The value of `w:spacing/@w:after` or |None| if not present.N)spacingafterrF   ro   s     r    spacing_afterzCT_PPr.spacing_after   s     ,,?}}r   c                L    || j                   y || j                         _        y rP   )ro   get_or_add_spacingrp   r[   s     r    rr   zCT_PPr.spacing_after   s$    =T\\1*/!'r   c                8    | j                   }|y|j                  S )z<The value of `w:spacing/@w:before` or |None| if not present.N)ro   beforerq   s     r    spacing_beforezCT_PPr.spacing_before   s     ,,?~~r   c                L    || j                   y || j                         _        y rP   )ro   rt   rv   r[   s     r    rw   zCT_PPr.spacing_before   s$    =T\\1+0!(r   c                8    | j                   }|y|j                  S )z:The value of `w:spacing/@w:line` or |None| if not present.N)ro   linerq   s     r    spacing_linezCT_PPr.spacing_line   s     ,,?||r   c                L    || j                   y || j                         _        y rP   )ro   rt   rz   r[   s     r    r{   zCT_PPr.spacing_line  s$    =T\\1).!&r   c                x    | j                   }|y|j                  }||j                  t        j                  S |S )au  The value of `w:spacing/@w:lineRule` as a member of the :ref:`WdLineSpacing`
        enumeration.

        Only the `MULTIPLE`, `EXACTLY`, and `AT_LEAST` members are used. It is the
        responsibility of the client to calculate the use of `SINGLE`, `DOUBLE`, and
        `MULTIPLE` based on the value of `w:spacing/@w:line` if that behavior is
        desired.
        N)ro   lineRulerz   r   MULTIPLE)rF   ro   r~   s      r    spacing_lineRulezCT_PPr.spacing_lineRule  s@     ,,?## 8"+++r   c                L    || j                   y || j                         _        y rP   )ro   rt   r~   r[   s     r    r   zCT_PPr.spacing_lineRule  s$    =T\\1-2!*r   c                8    | j                   }|y|j                  S )zGString contained in `./w:pStyle/@val`, or None if child is not present.N)r9   r$   )rF   r9   s     r    stylezCT_PPr.style   s     >zzr   c                X    || j                          y| j                         }||_        y)zSet `./w:pStyle/@val` `style`, adding a new element if necessary.

        If `style` is |None|, remove `./w:pStyle` when present.
        N)r)   r'   r$   )rF   r   r9   s      r    r   zCT_PPr.style(  s-     =!'')
r   c                8    | j                   }|y|j                  S )z:The value of `widowControl/@val` or |None| if not present.N)widowControlr$   )rF   r   s     r    widowControl_valzCT_PPr.widowControl_val4  s$     ((r   c                T    || j                          y || j                         _        y rP   )_remove_widowControlget_or_add_widowControlr$   r[   s     r    r   zCT_PPr.widowControl_val<  s$    =%%'16D((*.r   )returnzWD_ALIGN_PARAGRAPH | None)r   
str | None)r   r   )!r   r   r   r   __annotations___tag_seqr   r9   rc   r]   ri   r   numPrtabsro   rE   rU   sectPrpropertyrG   setterrN   rR   rW   r^   rd   rj   rr   rw   r{   r   r   r   r   r   r    r&   r&   +   sM   I..//&&&&%HL  )x| F  (12,?H-HQRLAI 3MO-(12,GLiHQRL9EX(23-8D>G
G
6C	6hrsm	4Bzhrsm<F " 
" 
"   __      < < ]]) )   4 4   3 3 # # :  :   0 0
   1 1
   / /
  " 3 3
   \\	 	     7 7r   r&   c                  X    e Zd ZdZ ede      Z ede      Z ede      Z	 ede
      Zy)
CT_Spacingzk``<w:spacing>`` element, specifying paragraph spacing attributes such as space
    before and line spacing.zw:afterzw:beforezw:linez
w:lineRuleN)r   r   r   r   r   r   rp   rv   r
   rz   r   r~   r   r   r    r   r   D  s:      i9Ez?;FX'<=D ?Hr   r   c                  f    e Zd ZdZ ede      Z edeej                        Z
 ede      ZddZy)	
CT_TabStopz`<w:tab>` element, representing an individual tab stop.

    Overloaded to use for a tab-character in a run, which also uses the w:tab tag but
    only needs a __str__ method.
    r#   zw:leader)defaultzw:posc                     y)zText equivalent of a `w:tab` element appearing in a run.

        Allows text of run inner-content to be accessed consistently across all text
        inner-content.
        	r   rV   s    r    __str__zCT_TabStop.__str__Y  s     r   N)r   str)r   r   r   r   r   r   r$   r   r	   SPACESleaderr
   posr   r   r   r    r   r   N  s<     G%5
6Cz=-BVBVWF
G%:
;Cr   r   c                  *    e Zd ZdZ edd      Zd Zy)CT_TabStopszC``<w:tabs>`` element, container for a sorted sequence of tab stops.zw:tabr   r7   c                    | j                         }|||c|_        |_        |_        | j                  D ]0  }|j                  |j                  k  s|j                  |       |c S  | j                  |       |S )z<Insert a newly created `w:tab` child element in `pos` order.)_new_tabr   r$   r   tab_lstaddpreviousappend)rF   r   alignr   new_tabtabs         r    insert_tab_in_orderzCT_TabStops.insert_tab_in_orderg  sj    --/36v0W['.<< 	C{{SWW$(	 	Gr   N)r   r   r   r   r   r   r   r   r   r    r   r   b  s    M
G
+C	r   r   N) r   
__future__r   typingr   r   docx.enum.textr   r   r   r	   docx.oxml.simpletypesr
   r   docx.oxml.xmlchemyr   r   r   r   r   docx.sharedr   docx.oxml.sectionr   docx.oxml.sharedr   r   r"   r&   r   r   r   r   r   r    <module>r      s    F " *  I  +*>_ >9O 9V7_ V7r@ @ (/ r   