
    pj.                    :   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dS )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                      e Zd ZU dZ ede          Zded<    ede          Zded<    ede	          Z
ded<    ed	e	          Zded
<   dS )CT_Indz6``<w:ind>`` element, specifying paragraph indentation.zw:leftLength | Noneleftzw:rightrightzw:firstLine	firstLinez	w:hanginghangingN)__name__
__module____qualname____doc__r   r
   r   __annotations__r   r   r   r        e/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/docx/oxml/text/parfmt.pyr   r      s         @@++' D     -,( E      10   I     /._ G      r!   r   c                  6    e Zd ZU dZ ede          Zded<   dS )CT_Jcz7``<w:jc>`` element, specifying paragraph justification.w:valr   valN)r   r   r   r   r   r   r&   r   r    r!   r"   r$   r$   -   sH         AA//# C      r!   r$   c                     e Zd ZU dZded<   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d"ed#<    ed$ed%d                   Z ed&ed'd                   Z[edHd*            Zej        dId,            ZedHd-            Zej        dId.            ZedHd/            Zej        dId0            ZedJd2            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:             Zej        d;             Zed<             Zej        d=             Zed>             Zej        d?             Zed@             Zej        dA             ZedKdC            Zej        dLdE            ZedF             Z e j        dG             Z dS )MCT_PPrz?``<w:pPr>`` element, containing the properties for a paragraph.zCallable[[], CT_Ind]get_or_add_indz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/      r0      r1      r2      r3      r4      r5      r6      zCT_Ind | Noneindr7      r8   #   returnr   c                d    | j         }|dS |j        }|t          |           S |j        }|dS |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)rE   r   r   r   )selfrE   r   r   s       r"   first_line_indentzCT_PPr.first_line_indentu   sJ     h;4+7(###M	4r!   valuec                    | j         |d S |                                 }d x|_        |_        |d S |dk     r
| |_        d S ||_        d S )Nr   )rE   r)   r   r   rJ   rL   rE   s      r"   rK   zCT_PPr.first_line_indent   s]    8F!!##&**=FQYY &CKKK!CMMMr!   c                &    | j         }|dS |j        S )z6The value of `w:ind/@w:left` or |None| if not present.N)rE   r   rJ   rE   s     r"   ind_leftzCT_PPr.ind_left   s     h;4xr!   c                R    |	| j         d S |                                 }||_        d S N)rE   r)   r   rN   s      r"   rQ   zCT_PPr.ind_left   s/    =TX-F!!##r!   c                &    | j         }|dS |j        S )z7The value of `w:ind/@w:right` or |None| if not present.N)rE   r   rP   s     r"   	ind_rightzCT_PPr.ind_right   s     h;4yr!   c                R    |	| j         d S |                                 }||_        d S rS   )rE   r)   r   rN   s      r"   rU   zCT_PPr.ind_right   s/    =TX-F!!##			r!   WD_ALIGN_PARAGRAPH | Nonec                ,    | j         | j         j        ndS )z=Value of the `<w:jc>` child element or |None| if not present.N)jcr&   rJ   s    r"   jc_valzCT_PPr.jc_val   s     #g1tw{{t;r!   c                h    ||                                   d S ||                                 _        d S rS   )
_remove_jcget_or_add_jcr&   rJ   rL   s     r"   r[   zCT_PPr.jc_val   s6    =OOF#(   r!   c                &    | j         }|dS |j        S )z7The value of `keepLines/@val` or |None| if not present.N)	keepLinesr&   )rJ   ra   s     r"   keepLines_valzCT_PPr.keepLines_val   s     N	4}r!   c                h    ||                                   d S ||                                 _        d S rS   )_remove_keepLinesget_or_add_keepLinesr&   r_   s     r"   rb   zCT_PPr.keepLines_val   s9    =""$$$$$.3D%%''+++r!   c                &    | j         }|dS |j        S )z6The value of `keepNext/@val` or |None| if not present.N)keepNextr&   )rJ   rg   s     r"   keepNext_valzCT_PPr.keepNext_val   s     =4|r!   c                h    ||                                   d S ||                                 _        d S rS   )_remove_keepNextget_or_add_keepNextr&   r_   s     r"   rh   zCT_PPr.keepNext_val   s9    =!!#####-2D$$&&***r!   c                &    | j         }|dS |j        S )z=The value of `pageBreakBefore/@val` or |None| if not present.N)pageBreakBeforer&   )rJ   rm   s     r"   pageBreakBefore_valzCT_PPr.pageBreakBefore_val   s      ."4""r!   c                h    ||                                   d S ||                                 _        d S rS   )_remove_pageBreakBeforeget_or_add_pageBreakBeforer&   r_   s     r"   rn   zCT_PPr.pageBreakBefore_val   s9    =((*****49D++--111r!   c                &    | j         }|dS |j        S )z;The value of `w:spacing/@w:after` or |None| if not present.N)spacingafterrJ   rs   s     r"   spacing_afterzCT_PPr.spacing_after   s     ,?4}r!   c                N    |	| j         d S ||                                 _        d S rS   )rs   get_or_add_spacingrt   r_   s     r"   rv   zCT_PPr.spacing_after   s-    =T\1F*/!!'''r!   c                &    | j         }|dS |j        S )z<The value of `w:spacing/@w:before` or |None| if not present.N)rs   beforeru   s     r"   spacing_beforezCT_PPr.spacing_before   s     ,?4~r!   c                N    |	| j         d S ||                                 _        d S rS   )rs   rx   rz   r_   s     r"   r{   zCT_PPr.spacing_before  s-    =T\1F+0!!(((r!   c                &    | j         }|dS |j        S )z:The value of `w:spacing/@w:line` or |None| if not present.N)rs   lineru   s     r"   spacing_linezCT_PPr.spacing_line  s     ,?4|r!   c                N    |	| j         d S ||                                 _        d S rS   )rs   rx   r~   r_   s     r"   r   zCT_PPr.spacing_line  s-    =T\1F).!!&&&r!   c                T    | j         }|dS |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)rs   lineRuler~   r   MULTIPLE)rJ   rs   r   s      r"   spacing_lineRulezCT_PPr.spacing_lineRule  s8     ,?4# 8"++r!   c                N    |	| j         d S ||                                 _        d S rS   )rs   rx   r   r_   s     r"   r   zCT_PPr.spacing_lineRule'  s-    =T\1F-2!!***r!   
str | Nonec                &    | j         }|dS |j        S )zGString contained in `./w:pStyle/@val`, or None if child is not present.N)r<   r&   )rJ   r<   s     r"   stylezCT_PPr.style-  s     >4zr!   r   c                l    ||                                   dS |                                 }||_        dS )zSet `./w:pStyle/@val` `style`, adding a new element if necessary.

        If `style` is |None|, remove `./w:pStyle` when present.
        N)r,   r*   r&   )rJ   r   r<   s      r"   r   zCT_PPr.style5  s<     =!!!F''))


r!   c                &    | j         }|dS |j        S )z:The value of `widowControl/@val` or |None| if not present.N)widowControlr&   )rJ   r   s     r"   widowControl_valzCT_PPr.widowControl_valA  s      (4r!   c                h    ||                                   d S ||                                 _        d S rS   )_remove_widowControlget_or_add_widowControlr&   r_   s     r"   r   zCT_PPr.widowControl_valI  s9    =%%'''''16D((**...r!   )rH   r   )rL   r   )rH   rW   )rH   r   )r   r   )!r   r   r   r   r   _tag_seqr   r<   rg   ra   rm   r   numPrtabsrs   rE   rY   sectPrpropertyrK   setterrQ   rU   r[   rb   rh   rn   rv   r{   r   r   r   r   r    r!   r"   r(   r(   5   s        II((((....////&&&&&&&&%HL  )yx|     F     y(122,???H	-HQRRLAAAIi 3MMMO9-(122,GGGLIiHQRRL999E9X(233-888Di>>>G"HRSSM  C     
6hrssm	4	4	4BYzhrssm<<<F   X" 
" 
" 
" 
"    X _   _    X     < < < X< ]) ) ])   X 4 4 4   X 3 3 3 # # X# : :  :   X 0 0 0
   X 1 1 1
   X / / /
   X" 3 3 3
    X \	 	 	 \	     X  7 7 7 7 7r!   r(   c                  r    e Zd ZdZ ede          Z ede          Z ede          Z	 ede
          ZdS )
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   rt   rz   r
   r~   r   r   r    r!   r"   r   r   Q  sc            i99Ez?;;FX'<==D  ??HHHr!   r   c                      e Zd ZU dZ ede          Zded<    ede	e	j
                  Zded<    ed	e          Zd
ed<   ddZdS )
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%   r   r&   zw:leader)defaultzWD_TAB_LEADER | Noneleaderzw:posr   posrH   strc                    dS )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    rZ   s    r"   __str__zCT_TabStop.__str__l  s	     tr!   N)rH   r   )r   r   r   r   r   r   r&   r   r   r	   SPACESr   r
   r   r   r    r!   r"   r   r   [  s           .-! C     $5#4M=+?$ $ $F     $#& C         r!   r   c                  2    e Zd ZdZ edd          Zd ZdS )CT_TabStopszC``<w:tabs>`` element, container for a sorted sequence of tab stops.zw:tabr    r:   c                    |                                  }|||c|_        |_        |_        | j        D ]+}|j        |j        k     r|                    |           |c S ,|                     |           |S )z<Insert a newly created `w:tab` child element in `pos` order.)_new_tabr   r&   r   tab_lstaddpreviousappend)rJ   r   alignr   new_tabtabs         r"   insert_tab_in_orderzCT_TabStops.insert_tab_in_orderz  s~    --//36v0W['.< 	 	C{SW$$((( % 	Gr!   N)r   r   r   r   r   r   r   r    r!   r"   r   r   u  s=        M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 F " " " " " " * * * * * * * *            I H H H H H H H                    +++++++******    _   "    O   Y7 Y7 Y7 Y7 Y7_ Y7 Y7 Y7x@ @ @ @ @ @ @ @       4    /     r!   