
    ,h7@                        d Z ddlmZmZmZmZ ddlZddlm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mZmZmZmZmZmZm Z m!Z! ddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z-m.Z.  G d de#      Z/ G d de#      Z0 G d de#      Z1 G d de#      Z2 G d de#      Z3 G d de#      Z4 G d de#      Z5 G d de#      Z6 G d de#      Z7 G d  d!e#      Z8 G d" d#e#      Z9 G d$ d%e#      Z: G d& d'e#      Z;y)(z4Custom element classes for text-related XML elements    )absolute_importdivisionprint_functionunicode_literalsN)
to_unicode)MSO_LANGUAGE_ID)MSO_AUTO_SIZEMSO_TEXT_UNDERLINE_TYPEMSO_VERTICAL_ANCHORPP_PARAGRAPH_ALIGNMENT)InvalidXmlError)	parse_xml)CT_GradientFillPropertiesnsdecls)	ST_Coordinate32&ST_TextFontScalePercentOrPercentStringST_TextFontSizeST_TextIndentLevelType$ST_TextSpacingPercentOrPercentStringST_TextSpacingPointST_TextTypefaceST_TextWrappingType
XsdBoolean)	BaseOxmlElementChoiceOneAndOnlyOne	OneOrMoreOptionalAttributeRequiredAttribute
ZeroOrMore	ZeroOrOneZeroOrOneChoice)EmuLengthc                   x    e Zd ZdZ edd      Z ed      Zed        Z	e	j                  d        Z	ed        Zy	)
CT_RegularTextRunz`a:r` custom element classa:rPr)a:t
successorsr)   c                 L    | j                   j                  }|t        |      S dS )z7(unicode) str containing text of (required) `a:t` child ttextr   )selfr0   s     P/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/oxml/text.pyr0   zCT_RegularTextRun.text4   s&     vv{{#'#3z$;;    c                 D    | j                  |      | j                  _        y)z+*str* is unicode value to replace run text.N)_escape_ctrl_charsr/   r0   )r1   strs     r2   r0   zCT_RegularTextRun.text;   s     --c2r3   c                 2    t        j                  dd |       S )a  Return str after replacing each control character with a plain-text escape.

        For example, a BEL character (x07) would appear as "_x0007_". Horizontal-tab
        (x09) and line-feed (x0A) are not escaped. All other characters in the range
        x00-x1F are escaped.
        z([\x00-\x08\x0B-\x1F])c                 <    dt        | j                  d            z  S )Nz_x%04X_   )ordgroup)matchs    r2   <lambda>z6CT_RegularTextRun._escape_ctrl_chars.<locals>.<lambda>I   s    YU[[QR^AT5T r3   )resub)ss    r2   r5   z$CT_RegularTextRun._escape_ctrl_chars@   s     vv%'TVW
 	
r3   N)__name__
__module____qualname____doc__r"   rPrr   r/   propertyr0   setterstaticmethodr5    r3   r2   r'   r'   .   sY    $
G
1CeA< < 
[[3 3 	
 	
r3   r'   c                       e Zd ZdZ ed      Z ed      Zd Ze	d        Z
e	d        Zed        Zed        Zed	        Zed
        Zd Zed        Zed        Zed        Zy)CT_TextBodyzg`p:txBody` custom element class.

    Also used for `c:txPr` in charts and perhaps other elements.
    za:bodyPrza:pc                 H    | j                   D ]  }| j                  |        y)zRemove all `a:p` children, but leave any others.

        cf. lxml `_Element.clear()` method which removes all children.
        N)p_lstremove)r1   ps     r2   clear_contentzCT_TextBody.clear_contentV   s"    
  	AKKN	r3   c                 d    | j                   d   }|j                         }|j                         }|S )z
        ``<a:defRPr>`` element of required first ``p`` child, added with its
        ancestors if not present. Used when element is a ``<c:txPr>`` in
        a chart and the ``p`` element is used only to specify formatting, not
        content.
        r   )rM   get_or_add_pPrget_or_add_defRPr)r1   rO   pPrdefRPrs       r2   rU   zCT_TextBody.defRPr^   s2     JJqM &&(r3   c                 z    | j                   }t        |      dkD  ry|st        d      |d   j                  dk7  ryy)z5True if only a single empty `a:p` element is present.r9   Fz#p:txBody must have at least one a:pr   r-   T)rM   lenr   r0   )r1   pss     r2   is_emptyzCT_TextBody.is_emptyk   s@     ZZr7Q;!"GHHa5::r3   c                 <    | j                         }t        |      }|S )z:
        Return a new ``<p:txBody>`` element tree
        )_txBody_tmplr   clsxmltxBodys      r2   newzCT_TextBody.newy   s     
  3r3   c                 <    | j                         }t        |      }|S )z
        Return a new ``<a:txBody>`` element tree, suitable for use in a table
        cell and possibly other situations.
        )_a_txBody_tmplr   r\   s      r2   new_a_txBodyzCT_TextBody.new_a_txBody   s        "3r3   c                 8    | j                         }t        |      S )zn
        Return a new ``<p:txBody>`` element tree, suitable for use in an
        ``<p:sp>`` element.
        )_p_txBody_tmplr   )r]   r^   s     r2   new_p_txBodyzCT_TextBody.new_p_txBody   s       "~r3   c                 :    dt        dd      z  }t        |      }|S )z
        Return a ``<c:txPr>`` element tree suitable for use in a chart object
        like data labels or tick labels.
        zp<c:txPr %s>
  <a:bodyPr/>
  <a:lstStyle/>
  <a:p>
    <a:pPr>
      <a:defRPr/>
    </a:pPr>
  </a:p>
</c:txPr>
car   r   )r]   r^   txPrs      r2   new_txPrzCT_TextBody.new_txPr   s*     C
 ~r3   c                 V    t        | j                        dkD  ry| j                          y)zEnsure p:txBody has at least one a:p child.

        Intuitively, reverse a ".clear_content()" operation to minimum
        conformance with spec (single empty paragraph).
        r   N)rW   rM   add_pr1   s    r2   unclear_contentzCT_TextBody.unclear_content   s      tzz?Q

r3   c                     dt        d      z  S )Nz1<a:txBody %s>
  <a:bodyPr/>
  <a:p/>
</a:txBody>
ri   r   r]   s    r2   rb   zCT_TextBody._a_txBody_tmpl   s      's|-	
r3   c                      dt        dd      z  S )Nz1<p:txBody %s>
  <a:bodyPr/>
  <a:p/>
</p:txBody>
rO   ri   r   rr   s    r2   re   zCT_TextBody._p_txBody_tmpl   s      'sC02	
r3   c                      dt        dd      z  S )NzA<p:txBody %s>
  <a:bodyPr/>
  <a:lstStyle/>
  <a:p/>
</p:txBody>
ri   rO   r   rr   s    r2   r[   zCT_TextBody._txBody_tmpl   s      'sC0	2	
r3   N)rA   rB   rC   rD   r   bodyPrr   rO   rP   rF   rU   rY   classmethodr`   rc   rf   rl   rp   rb   re   r[   rI   r3   r2   rK   rK   M   s    
 :&F%A 
 
          & 
 
 
 
 
 
r3   rK   c                   .   e Zd ZdZ e ed       ed       ed      fd      Z ede e	d      	      Z
 ed
e e	d      	      Z ede e	d      	      Z ede e	d      	      Z ede      Z ede      Zed        Zej(                  d        Zy)CT_TextBodyPropertiesz)
    <a:bodyPr> custom element class
    za:noAutofitza:normAutofitza:spAutoFit)z	a:scene3dza:sp3dza:flatTxa:extLstr*   lInsi0e defaulttInsi  rInsbInsanchorwrapc                     | j                   t        j                  S | j                  t        j                  S | j
                  t        j                  S y)zp
        The autofit setting for the text frame, a member of the
        ``MSO_AUTO_SIZE`` enumeration.
        N)	noAutofitr	   NONEnormAutofitTEXT_TO_FIT_SHAPE	spAutoFitSHAPE_TO_FIT_TEXTro   s    r2   autofitzCT_TextBodyProperties.autofit   sK     >>% %%%' 222>>% 222r3   c                 @   | |t         j                  vrt        d|z        | j                          |t         j                  k(  r| j                          y |t         j                  k(  r| j                          y |t         j                  k(  r| j                          y y )Nzoonly None or a member of the MSO_AUTO_SIZE enumeration can be assigned to CT_TextBodyProperties.autofit, got %s)
r	   _valid_settings
ValueError_remove_eg_textAutoFitr   _add_noAutofitr   _add_normAutofitr   _add_spAutoFitr1   values     r2   r   zCT_TextBodyProperties.autofit   s    m.K.K!KGINO  	##%M&&&!m555!!#m555! 6r3   N)rA   rB   rC   rD   r#   r   eg_textAutoFitr   r   r$   rz   r}   r~   r   r   r   r   r   rF   r   rG   rI   r3   r2   rx   rx      s     %		 79NOBN V_c%jIDV_c%jIDV_c%jIDV_c%jIDx)<=FV%89D  ^^" "r3   rx   c            
          e Zd ZdZ e ed       ed       ed       ed       ed       ed      fd	      Z ed
d	      Z edd	      Z	 e
de      Z e
de      Z e
de      Z e
de      Z e
de      Zd Zd Zy)CT_TextCharacterPropertiesz`a:rPr, a:defRPr, and `a:endParaRPr` custom element class.

    'rPr' is short for 'run properties', and it corresponds to the |Font|
    proxy class.
    za:noFillza:solidFillz
a:gradFillz
a:blipFillz
a:pattFillz	a:grpFill)za:effectLstza:effectDagza:highlightza:uLnTxza:uLnz	a:uFillTxza:uFilla:latina:eaa:csa:syma:hlinkClicka:hlinkMouseOvera:rtlry   r*   r   )r   r   r   r   r   r   ry   r   )r   r   ry   langszbiuc                 *    t        j                         S N)r   new_gradFillro   s    r2   _new_gradFillz(CT_TextCharacterProperties._new_gradFill6  s    (5577r3   c                 4    | j                         }||_        |S )zW
        Add an <a:hlinkClick> child element with r:id attribute set to *rId*.
        )get_or_add_hlinkClickrId)r1   r   
hlinkClicks      r2   add_hlinkClickz)CT_TextCharacterProperties.add_hlinkClick9  s     //1

r3   N)rA   rB   rC   rD   r#   r   eg_fillPropertiesr"   latinr   r   r   r   r   r   r   r   r   r
   r   r   r   rI   r3   r2   r   r      s     (:=!< < < ;	

6 
E #LJ V_5D	4	1B#z*A#z*A#67A8r3   r   c                   H    e Zd ZdZ edd      Z edd      Zed        Zy)	CT_TextFieldzH
    <a:fld> field element, for either a slide number or date field
    r(   )a:pPrr)   r*   r)   rI   c                 V    | j                   }|y|j                  }|t        |      S dS )z:
        The text of the ``<a:t>`` child element.
        r-   r.   )r1   r/   r0   s      r2   r0   zCT_TextField.textJ  s3    
 FF9vv#'#3z$;;r3   N)	rA   rB   rC   rD   r"   rE   r/   rF   r0   rI   r3   r2   r   r   B  s4     G(8
9C%B'A< <r3   r   c                   "    e Zd ZdZ ede      Zy)CT_TextFontz
    Custom element class for <a:latin>, <a:ea>, <a:cs>, and <a:sym> child
    elements of CT_TextCharacterProperties, e.g. <a:rPr>.
    typefaceN)rA   rB   rC   rD   r    r   r   rI   r3   r2   r   r   V  s    
 !_=Hr3   r   c                   4    e Zd ZdZ edd      Zed        Zy)CT_TextLineBreakz`a:br` line break elementr(   rI   r*   c                      y)zUnconditionally a single vertical-tab character.

        A line break element can contain no text other than the implicit line feed it
        represents.
        rI   ro   s    r2   r0   zCT_TextLineBreak.textd  s     r3   N)rA   rB   rC   rD   r"   rE   rF   r0   rI   r3   r2   r   r   _  s#    #
G
+C r3   r   c                   &    e Zd ZdZ eded      Zy)CT_TextNormalAutofitzS
    <a:normAutofit> element specifying fit text to shape font reduction, etc.
    	fontScaleg      Y@r{   N)rA   rB   rC   rD   r   r   r   rI   r3   r2   r   r   n  s     ";UIr3   r   c                       e Zd ZdZ edd      Z edd      Z edd      Z edd	      Z	d
 Z
ddZd Zed        Zed        Zd Zy)CT_TextParagraphz`a:p` custom element classr   )a:ra:brza:flda:endParaRPrr*   r   )r   r   r   rI   c                 "    | j                         S )z9
        Return a newly appended <a:br> element.
        )_add_brro   s    r2   add_brzCT_TextParagraph.add_br  s     ||~r3   Nc                 8    | j                         }|r||_        |S )z8
        Return a newly appended <a:r> element.
        )_add_rr0   )r1   r0   rs      r2   add_rzCT_TextParagraph.add_r  s     KKMAFr3   c                     t        t        j                  d|            D ].  \  }}|dkD  r| j                          |s| j	                  |       0 y)ao  Append `a:r` and `a:br` elements to *p* based on *text*.

        Any `
` or `` (vertical-tab) characters in *text* delimit `a:r` (run)
        elements and themselves are translated to `a:br` (line-break) elements. The
        vertical-tab character appears in clipboard text from PowerPoint at "soft"
        line-breaks (new-line, but not new paragraph).
        z
|r   N)	enumerater>   splitr   r   )r1   r0   idxr_strs       r2   append_textzCT_TextParagraph.append_text  sF     $BHHWd$;< 	"JCQw

5!	"r3   c                 N    t         t        t        ht        fd| D              S )zSequence containing text-container child elements of this `a:p` element.

        These include `a:r`, `a:br`, and `a:fld`.
        c              3   >   K   | ]  }t        |      v s|  y wr   )type).0elm
text_typess     r2   	<genexpr>z4CT_TextParagraph.content_children.<locals>.<genexpr>  s     DSDI,CSDs   )r'   r   r   tuple)r1   r   s    @r2   content_childrenz!CT_TextParagraph.content_children  s#     ()9<H
DDDDDr3   c                 r    dj                  | j                  D cg c]  }|j                   c}      S c c}w )z%str text contained in this paragraph.r-   )joinr   r0   )r1   childs     r2   r0   zCT_TextParagraph.text  s+     ww0E0EFu

FGGFs   4c                 4    dt        d      z  }t        |      S )Nz<a:r %s><a:t/></a:r>ri   rj   )r1   r_xmls     r2   _new_rzCT_TextParagraph._new_r  s    &5r3   r   )rA   rB   rC   rD   r"   rT   r!   r   br
endParaRPrr   r   r   rF   r   r0   r   rI   r3   r2   r   r   x  sx    $
G(P
QC5%67A	F'8	9B>b9J"  E E H H
 r3   r   c                   B   e Zd ZdZ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      Z e
de      Z[ed        Zej"                  d        Zed        Zej"                  d        Zed        Zej"                  d        Zy)CT_TextParagraphPropertiesz&
    <a:pPr> custom element class
    )a:lnSpca:spcBefa:spcAftz	a:buClrTxza:buClrza:buSzTxz	a:buSzPctz	a:buSzPtsz
a:buFontTxza:buFontza:buNoneza:buAutoNumza:buCharza:buBlipza:tabLsta:defRPrry   r   r9   Nr*   r      r      r      lvlr   r{   algnc                     | j                   }|y|j                  |j                  j                  S |j                  j                  S )a=  
        The spacing between baselines of successive lines in this paragraph.
        A float value indicates a number of lines. A |Length| value indicates
        a fixed spacing. Value is contained in `./a:lnSpc/a:spcPts/@val` or
        `./a:lnSpc/a:spcPct/@val`. Value is |None| if no element is present.
        N)lnSpcspcPtsvalspcPct)r1   r   s     r2   line_spacingz'CT_TextParagraphProperties.line_spacing  s?     

=<<#<<###||r3   c                     | j                          |y t        |t              r | j                         j	                  |       y | j                         j                  |       y r   )_remove_lnSpc
isinstancer%   
_add_lnSpc
set_spcPts
set_spcPctr   s     r2   r   z'CT_TextParagraphProperties.line_spacing  sJ    =eV$OO((/OO((/r3   c                 V    | j                   }|y|j                  }|y|j                  S )zd
        The EMU equivalent of the centipoints value in
        `./a:spcAft/a:spcPts/@val`.
        N)spcAftr   r   )r1   r   r   s      r2   space_afterz&CT_TextParagraphProperties.space_after  0     >>zzr3   c                 h    | j                          | | j                         j                  |       y y r   )_remove_spcAft_add_spcAftr   r   s     r2   r   z&CT_TextParagraphProperties.space_after  0    ))%0 r3   c                 V    | j                   }|y|j                  }|y|j                  S )zd
        The EMU equivalent of the centipoints value in
        `./a:spcBef/a:spcPts/@val`.
        N)spcBefr   r   )r1   r   r   s      r2   space_beforez'CT_TextParagraphProperties.space_before   r   r3   c                 h    | j                          | | j                         j                  |       y y r   )_remove_spcBef_add_spcBefr   r   s     r2   r   z'CT_TextParagraphProperties.space_before  r   r3   )rA   rB   rC   rD   _tag_seqr"   r   r   r   rU   r   r   r   r   r   rF   r   rG   r   r   rI   r3   r2   r   r     s    H& iHQRL9Ezhqrl;Fzhqrl;Fzhrsm<F
E#91
ECV%;<D    0 0   1 1
   1 1r3   r   c                   <    e Zd ZdZ ed      Z ed      Zd Zd Zy)CT_TextSpacingzB
    Used for <a:lnSpc>, <a:spcBef>, and <a:spcAft> elements.
    za:spcPctza:spcPtsc                 R    | j                          | j                         }||_        y)zr
        Set spacing to *value* lines, e.g. 1.75 lines. A ./a:spcPts child is
        removed if present.
        N)_remove_spcPtsget_or_add_spcPctr   )r1   r   r   s      r2   r   zCT_TextSpacing.set_spcPct  %    
 	'')
r3   c                 R    | j                          | j                         }||_        y)zb
        Set spacing to *value* points. A ./a:spcPct child is removed if
        present.
        N)_remove_spcPctget_or_add_spcPtsr   )r1   r   r   s      r2   r   zCT_TextSpacing.set_spcPts(  r	  r3   N)	rA   rB   rC   rD   r"   r   r   r   r   rI   r3   r2   r  r    s'     z"Fz"Fr3   r  c                   "    e Zd ZdZ ede      Zy)CT_TextSpacingPercentzh
    <a:spcPct> element, specifying spacing in thousandths of a percent in its
    `val` attribute.
    r   N)rA   rB   rC   rD   r    r   r   rI   r3   r2   r  r  2  s    
 E#G
HCr3   r  c                   "    e Zd ZdZ ede      Zy)CT_TextSpacingPointz[
    <a:spcPts> element, specifying spacing in centipoints in its `val`
    attribute.
    r   N)rA   rB   rC   rD   r    r   r   rI   r3   r2   r  r  ;  s    
 E#6
7Cr3   r  )<rD   
__future__r   r   r   r   r>   pptx.compatr   pptx.enum.langr   pptx.enum.textr	   r
   r   r   pptx.excr   	pptx.oxmlr   pptx.oxml.dml.fillr   pptx.oxml.nsr   pptx.oxml.simpletypesr   r   r   r   r   r   r   r   r   pptx.oxml.xmlchemyr   r   r   r   r   r    r!   r"   r#   	pptx.utilr$   r%   r'   rK   rx   r   r   r   r   r   r   r   r  r  r  rI   r3   r2   <module>r     s    ; R R 	 " *  %  8  
 
 

 
 
 "
 
>@
/ @
F+"O +"\A AH<? <(>/ > ? 8  8 v_1 _1D_ :IO I8/ 8r3   